@@ -413,14 +413,14 @@ class TimeoutTests {
413413
414414@ Test
415415void retryWithImmediateSuccessAndTimeoutExceeded () throws Exception {
416- RetryPolicy retryPolicy = RetryPolicy .builder ().timeout (Duration .ofMillis (5 )).build ();
416+ RetryPolicy retryPolicy = RetryPolicy .builder ().timeout (Duration .ofMillis (10 )).build ();
417417RetryTemplate retryTemplate = new RetryTemplate (retryPolicy );
418418retryTemplate .setRetryListener (retryListener );
419419
420420AtomicInteger invocationCount = new AtomicInteger ();
421421Retryable <String > retryable = () -> {
422422invocationCount .incrementAndGet ();
423- Thread .sleep (10 );
423+ Thread .sleep (100 );
424424return "always succeeds" ;
425425};
426426
@@ -435,15 +435,15 @@ void retryWithImmediateSuccessAndTimeoutExceeded() throws Exception {
435435@ Test
436436void retryWithInitialFailureAndZeroRetriesRetryPolicyAndTimeoutExceeded () {
437437RetryPolicy retryPolicy = RetryPolicy .builder ()
438- .timeout (Duration .ofMillis (5 ))
438+ .timeout (Duration .ofMillis (10 ))
439439.predicate (throwable -> false ) // Zero retries
440440.build ();
441441RetryTemplate retryTemplate = new RetryTemplate (retryPolicy );
442442retryTemplate .setRetryListener (retryListener );
443443
444444Exception exception = new RuntimeException ("Boom!" );
445445Retryable <String > retryable = () -> {
446- Thread .sleep (10 );
446+ Thread .sleep (100 );
447447throw exception ;
448448};
449449
@@ -461,22 +461,22 @@ void retryWithInitialFailureAndZeroRetriesRetryPolicyAndTimeoutExceeded() {
461461@ Test
462462void retryWithTimeoutExceededAfterInitialFailure () throws Exception {
463463RetryPolicy retryPolicy = RetryPolicy .builder ()
464- .timeout (Duration .ofMillis (5 ))
464+ .timeout (Duration .ofMillis (10 ))
465465.delay (Duration .ZERO )
466466.build ();
467467RetryTemplate retryTemplate = new RetryTemplate (retryPolicy );
468468retryTemplate .setRetryListener (retryListener );
469469
470470AtomicInteger invocationCount = new AtomicInteger ();
471471Retryable <String > retryable = () -> {
472- Thread .sleep (10 );
472+ Thread .sleep (100 );
473473throw new CustomException ("Boom " + invocationCount .incrementAndGet ());
474474};
475475
476476assertThat (invocationCount ).hasValue (0 );
477477assertThatExceptionOfType (RetryException .class )
478478.isThrownBy (() -> retryTemplate .execute (retryable ))
479- .withMessageMatching ("Retry policy for operation '.+?' exceeded timeout \\ (5ms \\ ); aborting execution" )
479+ .withMessageMatching ("Retry policy for operation '.+?' exceeded timeout \\ (10ms \\ ); aborting execution" )
480480.withCause (new CustomException ("Boom 1" ))
481481.satisfies (throwable -> inOrder .verify (retryListener ).onRetryPolicyTimeout (
482482eq (retryPolicy ), eq (retryable ), eq (throwable )));
@@ -488,8 +488,8 @@ void retryWithTimeoutExceededAfterInitialFailure() throws Exception {
488488@ Test
489489void retryWithTimeoutExceededAfterFirstDelayButBeforeFirstRetry () throws Exception {
490490RetryPolicy retryPolicy = RetryPolicy .builder ()
491- .timeout (Duration .ofMillis (5 ))
492- .delay (Duration .ofMillis (10 )) // Delay > Timeout
491+ .timeout (Duration .ofMillis (20 ))
492+ .delay (Duration .ofMillis (100 )) // Delay > Timeout
493493.build ();
494494RetryTemplate retryTemplate = new RetryTemplate (retryPolicy );
495495retryTemplate .setRetryListener (retryListener );
@@ -503,8 +503,8 @@ void retryWithTimeoutExceededAfterFirstDelayButBeforeFirstRetry() throws Excepti
503503assertThatExceptionOfType (RetryException .class )
504504.isThrownBy (() -> retryTemplate .execute (retryable ))
505505.withMessageMatching ("""
506- Retry policy for operation '.+?' would exceed timeout \\ (5ms \\ ) \
507- due to pending sleep time \\ (10ms \\ ); preemptively aborting execution\
506+ Retry policy for operation '.+?' would exceed timeout \\ (20ms \\ ) \
507+ due to pending sleep time \\ (100ms \\ ); preemptively aborting execution\
508508""" )
509509.withCause (new CustomException ("Boom 1" ))
510510.satisfies (throwable -> inOrder .verify (retryListener ).onRetryPolicyTimeout (
@@ -527,7 +527,7 @@ void retryWithTimeoutExceededAfterFirstRetry() throws Exception {
527527Retryable <String > retryable = () -> {
528528int currentInvocation = invocationCount .incrementAndGet ();
529529if (currentInvocation == 2 ) {
530- Thread .sleep (50 );
530+ Thread .sleep (100 );
531531}
532532throw new CustomException ("Boom " + currentInvocation );
533533};
@@ -562,7 +562,7 @@ void retryWithTimeoutExceededAfterSecondRetry() throws Exception {
562562Retryable <String > retryable = () -> {
563563int currentInvocation = invocationCount .incrementAndGet ();
564564if (currentInvocation == 3 ) {
565- Thread .sleep (50 );
565+ Thread .sleep (100 );
566566}
567567throw new CustomException ("Boom " + currentInvocation );
568568};
0 commit comments