Overview
After experimenting with our newly introduced core retry support (RetryPolicy, RetryTemplate, etc.) and @Retryable support, it has become apparent that there are overlapping concerns between the current RetryPolicy and BackOff contracts.
RetryPolicyandBackOffboth have stateful executions:RetryExecutionandBackOffExecution. However, only one stateful execution is necessary.FixedBackOffandExponentialBackOffalready incorporate "retry" logic in terms of max attempts, max elapsed time, etc. Thus, there is no need to duplicate such behavior in aRetryPolicyand itsRetryExecution.RetryTemplatecurrently accepts both aRetryPolicyand aBackOffin order to instrument the retry algorithm. However, users would probably rather focus on configuring all "retry" logic via a single mechanism.
Deliverables
In light of the above, we have decided to directly incorporate BackOff in RetryPolicy. To achieve that, we will do the following.
- [x] Remove the
RetryExecutioninterface and move itsshouldRetry()method toRetryPolicy, replacing the currentRetryExecution start()method. - [x] Introduce a
defaultgetBackOff()method in theRetryPolicyinterface. - [x] Completely overhaul the
RetryPolicy.Builderto provide support for configuring aBackOffstrategy. - [x] Remove
BackOffconfiguration fromRetryTemplate.
Related Issues
-
34716
-
34529
-
35058