File tree 2 files changed +22
-4
lines changed
flink-connector-aws/flink-connector-kinesis/src
main/java/org/apache/flink/streaming/connectors/kinesis/util
test/java/org/apache/flink/streaming/connectors/kinesis/util 2 files changed +22
-4
lines changed Original file line number Diff line number Diff line change 18
18
package org .apache .flink .streaming .connectors .kinesis .util ;
19
19
20
20
import org .apache .flink .annotation .Internal ;
21
+ import org .apache .flink .util .ExceptionUtils ;
21
22
22
23
import software .amazon .awssdk .http .SdkHttpConfigurationOption ;
23
24
import software .amazon .awssdk .services .kinesis .model .LimitExceededException ;
@@ -74,8 +75,12 @@ public static boolean isNoneEfoRegistrationType(final Properties properties) {
74
75
}
75
76
76
77
public static boolean isRecoverableException (Exception e ) {
77
- Throwable cause = e .getCause ();
78
- return cause instanceof LimitExceededException
79
- || cause instanceof ProvisionedThroughputExceededException ;
78
+ return ExceptionUtils .findThrowable (
79
+ e ,
80
+ throwable ->
81
+ throwable instanceof LimitExceededException
82
+ || throwable
83
+ instanceof ProvisionedThroughputExceededException )
84
+ .isPresent ();
80
85
}
81
86
}
Original file line number Diff line number Diff line change 20
20
import org .junit .Test ;
21
21
import software .amazon .awssdk .http .SdkHttpConfigurationOption ;
22
22
import software .amazon .awssdk .services .kinesis .model .LimitExceededException ;
23
+ import software .amazon .awssdk .services .kinesis .model .ProvisionedThroughputExceededException ;
23
24
import software .amazon .awssdk .utils .AttributeMap ;
24
25
25
26
import java .time .Duration ;
@@ -133,7 +134,19 @@ public void testIsNoneEfoRegistrationType() {
133
134
}
134
135
135
136
@ Test
136
- public void testIsRecoverableExceptionForRecoverable () {
137
+ public void testIsRecoverableExceptionForRecoverableLimitExceeded () {
138
+ Exception recoverable = LimitExceededException .builder ().build ();
139
+ assertThat (AwsV2Util .isRecoverableException (recoverable )).isTrue ();
140
+ }
141
+
142
+ @ Test
143
+ public void testIsRecoverableExceptionForRecoverableProvisionedThroughputExceeded () {
144
+ Exception recoverable = ProvisionedThroughputExceededException .builder ().build ();
145
+ assertThat (AwsV2Util .isRecoverableException (recoverable )).isTrue ();
146
+ }
147
+
148
+ @ Test
149
+ public void testIsRecoverableExceptionForRecoverableWrapped () {
137
150
Exception recoverable = LimitExceededException .builder ().build ();
138
151
assertThat (AwsV2Util .isRecoverableException (new ExecutionException (recoverable ))).isTrue ();
139
152
}
You can’t perform that action at this time.
0 commit comments