diff --git a/src/main/java/org/springframework/data/neo4j/core/support/RetryExceptionPredicate.java b/src/main/java/org/springframework/data/neo4j/core/support/RetryExceptionPredicate.java index e4bfb5303..14223fb98 100644 --- a/src/main/java/org/springframework/data/neo4j/core/support/RetryExceptionPredicate.java +++ b/src/main/java/org/springframework/data/neo4j/core/support/RetryExceptionPredicate.java @@ -20,6 +20,7 @@ import java.util.function.Predicate; import org.apiguardian.api.API; import org.neo4j.driver.exceptions.DiscoveryException; +import org.neo4j.driver.exceptions.RetryableException; import org.neo4j.driver.exceptions.ServiceUnavailableException; import org.neo4j.driver.exceptions.SessionExpiredException; import org.neo4j.driver.exceptions.TransientException; @@ -43,6 +44,10 @@ public final class RetryExceptionPredicate implements Predicate { @Override public boolean test(Throwable throwable) { + if (throwable instanceof RetryableException) { + return true; + } + if (throwable instanceof IllegalStateException) { String msg = throwable.getMessage(); return msg != null && RETRYABLE_ILLEGAL_STATE_MESSAGES.contains(msg);