|
20 | 20 |
|
21 | 21 | import io.netty.util.concurrent.EventExecutor;
|
22 | 22 | import io.netty.util.concurrent.EventExecutorGroup;
|
| 23 | + |
| 24 | +import org.neo4j.driver.util.Experimental; |
23 | 25 | import org.reactivestreams.Publisher;
|
24 | 26 | import reactor.core.publisher.Flux;
|
25 | 27 | import reactor.core.publisher.Mono;
|
@@ -104,7 +106,7 @@ public <T> T retry( Supplier<T> work )
|
104 | 106 | catch ( Throwable throwable )
|
105 | 107 | {
|
106 | 108 | Throwable error = extractPossibleTerminationCause( throwable );
|
107 |
| - if ( canRetryOn( error ) ) |
| 109 | + if ( isRetryable( error ) ) |
108 | 110 | {
|
109 | 111 | long currentTime = clock.millis();
|
110 | 112 | if ( startTime == -1 )
|
@@ -146,7 +148,8 @@ public <T> Publisher<T> retryRx( Publisher<T> work )
|
146 | 148 | return Flux.from( work ).retryWhen( retryRxCondition() );
|
147 | 149 | }
|
148 | 150 |
|
149 |
| - protected boolean canRetryOn( Throwable error ) |
| 151 | + @Experimental |
| 152 | + public static boolean isRetryable( Throwable error ) |
150 | 153 | {
|
151 | 154 | return error instanceof SessionExpiredException || error instanceof ServiceUnavailableException || isTransientError( error );
|
152 | 155 | }
|
@@ -183,7 +186,7 @@ private Function<Flux<Throwable>,Publisher<Context>> retryRxCondition()
|
183 | 186 | long startTime = ctx.getOrDefault( "startTime", -1L );
|
184 | 187 | long nextDelayMs = ctx.getOrDefault( "nextDelayMs", initialRetryDelayMs );
|
185 | 188 |
|
186 |
| - if ( canRetryOn( error ) ) |
| 189 | + if ( isRetryable( error ) ) |
187 | 190 | {
|
188 | 191 | long currentTime = clock.millis();
|
189 | 192 | if ( startTime == -1 )
|
@@ -270,7 +273,7 @@ private <T> void retryOnError( CompletableFuture<T> resultFuture, Supplier<Compl
|
270 | 273 | List<Throwable> errors )
|
271 | 274 | {
|
272 | 275 | Throwable error = extractPossibleTerminationCause( throwable );
|
273 |
| - if ( canRetryOn( error ) ) |
| 276 | + if ( isRetryable( error ) ) |
274 | 277 | {
|
275 | 278 | long currentTime = clock.millis();
|
276 | 279 | if ( startTime == -1 )
|
|
0 commit comments