RESOLVED - issue BATCH-1426: RetryTemplate calls BackOffPolicy even when retry will not occur.

This commit is contained in:
dsyer
2009-11-06 08:45:02 +00:00
parent f952924479
commit 05b5ac14cb
3 changed files with 14 additions and 15 deletions

View File

@@ -245,15 +245,17 @@ public class RetryTemplate implements RetryOperations {
registerThrowable(retryPolicy, state, context, e);
try {
backOffPolicy.backOff(backOffContext);
}
catch (BackOffInterruptedException ex) {
lastException = e;
// back off was prevented by another thread - fail the
// retry
logger.debug("Abort retry because interrupted: count=" + context.getRetryCount());
throw ex;
if (canRetry(retryPolicy, context) && !context.isExhaustedOnly()) {
try {
backOffPolicy.backOff(backOffContext);
}
catch (BackOffInterruptedException ex) {
lastException = e;
// back off was prevented by another thread - fail
// the retry
logger.debug("Abort retry because interrupted: count=" + context.getRetryCount());
throw ex;
}
}
logger.debug("Checking for rethrow: count=" + context.getRetryCount());