Package org.springframework.retry.policy
Class NeverRetryPolicy
java.lang.Object
org.springframework.retry.policy.NeverRetryPolicy
- All Implemented Interfaces:
Serializable,RetryPolicy
- Direct Known Subclasses:
AlwaysRetryPolicy
A
RetryPolicy that allows the first attempt but never permits a retry. Also be
used as a base class for other policies, e.g. for test purposes as a stub.- Author:
- Dave Syer
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancanRetry(RetryContext context) Returns false after the first exception.voidclose(RetryContext context) Do nothing.open(RetryContext parent) Return a context that can respond to early termination requests, but does nothing else.voidregisterThrowable(RetryContext context, Throwable throwable) Make the throwable available for downstream use through the context.
-
Constructor Details
-
NeverRetryPolicy
public NeverRetryPolicy()
-
-
Method Details
-
canRetry
Returns false after the first exception. So there is always one try, and then the retry is prevented.- Specified by:
canRetryin interfaceRetryPolicy- Parameters:
context- the current retry status- Returns:
- true if the operation can proceed
- See Also:
-
close
Do nothing.- Specified by:
closein interfaceRetryPolicy- Parameters:
context- a retry status created by theRetryPolicy.open(RetryContext)method of this policy.- See Also:
-
open
Return a context that can respond to early termination requests, but does nothing else.- Specified by:
openin interfaceRetryPolicy- Parameters:
parent- the parent context if we are in a nested retry.- Returns:
- a
RetryContextobject specific to this policy. - See Also:
-
registerThrowable
Make the throwable available for downstream use through the context.- Specified by:
registerThrowablein interfaceRetryPolicy- Parameters:
context- the current status object.throwable- the exception to throw- See Also:
-