Package org.springframework.retry.policy
Class BinaryExceptionClassifierRetryPolicy
java.lang.Object
org.springframework.retry.policy.BinaryExceptionClassifierRetryPolicy
- All Implemented Interfaces:
Serializable
,RetryPolicy
A policy, that is based on
BinaryExceptionClassifier
. Usually, binary
classification is enough for retry purposes. If you need more flexible classification,
use ExceptionClassifierRetryPolicy
.- Author:
- Aleksandr Shamukov
- See Also:
-
Field Summary
Fields inherited from interface org.springframework.retry.RetryPolicy
NO_MAXIMUM_ATTEMPTS_SET
-
Constructor Summary
ConstructorDescriptionBinaryExceptionClassifierRetryPolicy
(BinaryExceptionClassifier exceptionClassifier) -
Method Summary
Modifier and TypeMethodDescriptionboolean
canRetry
(RetryContext context) void
close
(RetryContext status) open
(RetryContext parent) Acquire resources needed for the retry operation.void
registerThrowable
(RetryContext context, Throwable throwable) Called once per retry attempt, after the callback fails.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.retry.RetryPolicy
getMaxAttempts
-
Constructor Details
-
BinaryExceptionClassifierRetryPolicy
-
-
Method Details
-
getExceptionClassifier
-
canRetry
- Specified by:
canRetry
in interfaceRetryPolicy
- Parameters:
context
- the current retry status- Returns:
- true if the operation can proceed
-
close
- Specified by:
close
in interfaceRetryPolicy
- Parameters:
status
- a retry status created by theRetryPolicy.open(RetryContext)
method of this policy.
-
registerThrowable
Description copied from interface:RetryPolicy
Called once per retry attempt, after the callback fails.- Specified by:
registerThrowable
in interfaceRetryPolicy
- Parameters:
context
- the current status object.throwable
- the exception to throw
-
open
Description copied from interface:RetryPolicy
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.- Specified by:
open
in interfaceRetryPolicy
- Parameters:
parent
- the parent context if we are in a nested retry.- Returns:
- a
RetryContext
object specific to this policy.
-