|
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; |
25 | 23 | import org.reactivestreams.Publisher;
|
26 | 24 | import reactor.core.publisher.Flux;
|
27 | 25 | import reactor.core.publisher.Mono;
|
|
47 | 45 | import org.neo4j.driver.exceptions.TransientException;
|
48 | 46 | import org.neo4j.driver.internal.util.Clock;
|
49 | 47 | import org.neo4j.driver.internal.util.Futures;
|
| 48 | +import org.neo4j.driver.util.Experimental; |
50 | 49 |
|
51 | 50 | import static java.util.concurrent.TimeUnit.SECONDS;
|
52 | 51 |
|
@@ -106,7 +105,7 @@ public <T> T retry( Supplier<T> work )
|
106 | 105 | catch ( Throwable throwable )
|
107 | 106 | {
|
108 | 107 | Throwable error = extractPossibleTerminationCause( throwable );
|
109 |
| - if ( isRetryable( error ) ) |
| 108 | + if ( canRetryOn( error ) ) |
110 | 109 | {
|
111 | 110 | long currentTime = clock.millis();
|
112 | 111 | if ( startTime == -1 )
|
@@ -148,6 +147,11 @@ public <T> Publisher<T> retryRx( Publisher<T> work )
|
148 | 147 | return Flux.from( work ).retryWhen( retryRxCondition() );
|
149 | 148 | }
|
150 | 149 |
|
| 150 | + protected boolean canRetryOn( Throwable error ) |
| 151 | + { |
| 152 | + return isRetryable( error ); |
| 153 | + } |
| 154 | + |
151 | 155 | @Experimental
|
152 | 156 | public static boolean isRetryable( Throwable error )
|
153 | 157 | {
|
@@ -186,7 +190,7 @@ private Function<Flux<Throwable>,Publisher<Context>> retryRxCondition()
|
186 | 190 | long startTime = ctx.getOrDefault( "startTime", -1L );
|
187 | 191 | long nextDelayMs = ctx.getOrDefault( "nextDelayMs", initialRetryDelayMs );
|
188 | 192 |
|
189 |
| - if ( isRetryable( error ) ) |
| 193 | + if ( canRetryOn( error ) ) |
190 | 194 | {
|
191 | 195 | long currentTime = clock.millis();
|
192 | 196 | if ( startTime == -1 )
|
@@ -273,7 +277,7 @@ private <T> void retryOnError( CompletableFuture<T> resultFuture, Supplier<Compl
|
273 | 277 | List<Throwable> errors )
|
274 | 278 | {
|
275 | 279 | Throwable error = extractPossibleTerminationCause( throwable );
|
276 |
| - if ( isRetryable( error ) ) |
| 280 | + if ( canRetryOn( error ) ) |
277 | 281 | {
|
278 | 282 | long currentTime = clock.millis();
|
279 | 283 | if ( startTime == -1 )
|
|
0 commit comments