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:
-
Field Summary
Fields inherited from interface org.springframework.retry.RetryPolicy
NO_MAXIMUM_ATTEMPTS_SET
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
canRetry
(RetryContext context) Returns false after the first exception.void
close
(RetryContext context) Do nothing.open
(RetryContext parent) Return a context that can respond to early termination requests, but does nothing else.void
registerThrowable
(RetryContext context, Throwable throwable) Make the throwable available for downstream use through the context.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
-
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:
canRetry
in interfaceRetryPolicy
- Parameters:
context
- the current retry status- Returns:
- true if the operation can proceed
- See Also:
-
close
Do nothing.- Specified by:
close
in 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:
open
in interfaceRetryPolicy
- Parameters:
parent
- the parent context if we are in a nested retry.- Returns:
- a
RetryContext
object specific to this policy. - See Also:
-
registerThrowable
Make the throwable available for downstream use through the context.- Specified by:
registerThrowable
in interfaceRetryPolicy
- Parameters:
context
- the current status object.throwable
- the exception to throw- See Also:
-