Skip to content

Commit

Permalink
Make canRetryOn function public. (#764)
Browse files Browse the repository at this point in the history
* Make canRetryOn function public.

Make it static and rename it to isRetryable.
To be used as experimental API.

* Fix compile issue

Co-authored-by: Gregory Woods <[email protected]>
  • Loading branch information
gjmwoods and gjmwoods authored Oct 2, 2020
2 parents b20a89b + 21a8f43 commit 3644616
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import org.neo4j.driver.exceptions.TransientException;
import org.neo4j.driver.internal.util.Clock;
import org.neo4j.driver.internal.util.Futures;
import org.neo4j.driver.util.Experimental;

import static java.util.concurrent.TimeUnit.SECONDS;

Expand Down Expand Up @@ -147,6 +148,12 @@ public <T> Publisher<T> retryRx( Publisher<T> work )
}

protected boolean canRetryOn( Throwable error )
{
return isRetryable( error );
}

@Experimental
public static boolean isRetryable( Throwable error )
{
return error instanceof SessionExpiredException || error instanceof ServiceUnavailableException || isTransientError( error );
}
Expand Down

0 comments on commit 3644616

Please sign in to comment.