GH-264: Docs and Javadocs

This commit is contained in:
Gary Russell
2022-04-12 11:43:37 -04:00
parent ec245fd1ba
commit 0c1fa828a8
2 changed files with 11 additions and 0 deletions

View File

@@ -200,6 +200,10 @@ Foo foo = template.execute(new RetryCallback<Foo>() {
If the business logic does not succeed before the template decides to abort, the client is
given the chance to do some alternate processing through the recovery callback.
Version 1.3.3 added the `noRecoveryForNotRetryable` property to the template.
When `true`, the recovery callback is not invoked if the retry policy is configured with a not-retryable exception and one is thrown.
By default, the recovery callback is always called, regardless of whether the exception is retryable or not.
## Stateless Retry
In the simplest case, a retry is just a while loop: the `RetryTemplate` can keep trying
@@ -576,6 +580,8 @@ Expressions can contain property placeholders, such as `#{${max.delay}}` or
during initialization. There is no root object for the evaluation but they can reference
other beans in the context.
Version 1.3.3 added the `rethrow` attribute to `@Retryable`; when `true` any exceptions that are not retryable are thrown unchanged to the caller and the `@Recover` method is not called.
#### <a name="Additional_Dependencies"></a> Additional Dependencies
The declarative approach to applying retry handling by using the `@Retryable` annotation

View File

@@ -127,6 +127,10 @@ public class RetryTemplate implements RetryOperations {
}
/**
* Set to true to not call the recovery callback (if any) when a not-retryable
* exception is thrown by the target code in
* {@link #execute(RetryCallback, RecoveryCallback)}. By default, the callback is
* invoked when retries are exhausted, or immediately for not-retryable exceptions.
* @param noRecoveryForNotRetryable the noRecoveryForNotRetryable to set
* @since 1.3.3
*/
@@ -542,6 +546,7 @@ public class RetryTemplate implements RetryOperations {
if (state != null && !context.hasAttribute(GLOBAL_STATE)) {
this.retryContextCache.remove(state.getKey());
}
// TODO: In 2.0 add retryForException() to the interface.
if (this.noRecoveryForNotRetryable && retryPolicy instanceof SimpleRetryPolicy
&& !((SimpleRetryPolicy) retryPolicy).retryForException(context.getLastThrowable())) {
throw context.getLastThrowable();