File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed
main/java/org/springframework/data/neo4j/core/support
test/java/org/springframework/data/neo4j/core/support Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change 2222import java .util .function .Predicate ;
2323
2424import org .apiguardian .api .API ;
25+ import org .neo4j .driver .exceptions .DiscoveryException ;
2526import org .neo4j .driver .exceptions .ServiceUnavailableException ;
2627import org .neo4j .driver .exceptions .SessionExpiredException ;
2728import org .neo4j .driver .exceptions .TransientException ;
@@ -60,7 +61,7 @@ public boolean test(Throwable throwable) {
6061 return !("Neo.TransientError.Transaction.Terminated" .equals (code ) ||
6162 "Neo.TransientError.Transaction.LockClientStopped" .equals (code ));
6263 } else {
63- return ex instanceof SessionExpiredException || ex instanceof ServiceUnavailableException ;
64+ return ex instanceof SessionExpiredException || ex instanceof ServiceUnavailableException || ex instanceof DiscoveryException ;
6465 }
6566 }
6667}
Original file line number Diff line number Diff line change 2121import org .junit .jupiter .params .ParameterizedTest ;
2222import org .junit .jupiter .params .provider .ValueSource ;
2323import org .junit .platform .commons .util .ReflectionUtils ;
24+ import org .neo4j .driver .exceptions .DiscoveryException ;
2425import org .neo4j .driver .exceptions .ServiceUnavailableException ;
2526import org .neo4j .driver .exceptions .SessionExpiredException ;
2627import org .springframework .dao .TransientDataAccessResourceException ;
@@ -48,6 +49,13 @@ void shouldNotRetryOnRandomIllegalStateExceptions() {
4849 assertThat (predicate .test (new IllegalStateException ())).isFalse ();
4950 }
5051
52+ @ Test // GH-2311
53+ void shouldRetryDiscoveryExceptions () {
54+
55+ RetryExceptionPredicate predicate = new RetryExceptionPredicate ();
56+ assertThat (predicate .test (new DiscoveryException ("Broken" , new RuntimeException ()))).isTrue ();
57+ }
58+
5159 @ Test
5260 void shouldPlayWellWithExceptionTranslator () {
5361
You can’t perform that action at this time.
0 commit comments