Exposes last exception as cause in RetryException.
Applies first back-off after the initial exception.
Breaks out of retry loop on BackOffExecution.STOP.
Expects null result in Retryable and RetryListener.
Closes gh-35057
@ -158,10 +158,26 @@ public class RetryTemplate implements RetryOperations {
@@ -158,10 +158,26 @@ public class RetryTemplate implements RetryOperations {
logger.debug(()->"Backing off for %dms after retryable operation '%s'"
.formatted(duration,retryableName));
Thread.sleep(duration);
}
catch(InterruptedExceptioninterruptedException){
Thread.currentThread().interrupt();
thrownewRetryException(
"Unable to back off for retryable operation '%s'".formatted(retryableName),
interruptedException);
}
logger.debug(()->"Preparing to retry operation '%s'".formatted(retryableName));
try{
this.retryListener.beforeRetry(retryExecution);
@ -172,29 +188,22 @@ public class RetryTemplate implements RetryOperations {
@@ -172,29 +188,22 @@ public class RetryTemplate implements RetryOperations {
returnresult;
}
catch(ThrowablecurrentAttemptException){
logger.debug(()->"Retry attempt for operation '%s' failed due to '%s'"
@ -63,13 +64,14 @@ public class CompositeRetryListener implements RetryListener {
@@ -63,13 +64,14 @@ public class CompositeRetryListener implements RetryListener {