Package org.springframework.retry
Interface RetryPolicy
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
AlwaysRetryPolicy,BinaryExceptionClassifierRetryPolicy,CircuitBreakerRetryPolicy,CompositeRetryPolicy,ExceptionClassifierRetryPolicy,ExpressionRetryPolicy,MaxAttemptsRetryPolicy,NeverRetryPolicy,SimpleRetryPolicy,TimeoutRetryPolicy
A
RetryPolicy is responsible for allocating and managing resources needed by
RetryOperations. The RetryPolicy allows retry operations to be aware of
their context. Context can be internal to the retry framework, e.g. to support nested
retries. Context can also be external, and the RetryPolicy provides a uniform
API for a range of different platforms for the external context.- Author:
- Dave Syer
-
Method Summary
Modifier and TypeMethodDescriptionbooleancanRetry(RetryContext context) voidclose(RetryContext context) open(RetryContext parent) Acquire resources needed for the retry operation.voidregisterThrowable(RetryContext context, Throwable throwable) Called once per retry attempt, after the callback fails.
-
Method Details
-
canRetry
- Parameters:
context- the current retry status- Returns:
- true if the operation can proceed
-
open
Acquire resources needed for the retry operation. The callback is passed in so that marker interfaces can be used and a manager can collaborate with the callback to set up some state in the status token.- Parameters:
parent- the parent context if we are in a nested retry.- Returns:
- a
RetryContextobject specific to this policy.
-
close
- Parameters:
context- a retry status created by theopen(RetryContext)method of this policy.
-
registerThrowable
Called once per retry attempt, after the callback fails.- Parameters:
context- the current status object.throwable- the exception to throw
-