Class RetryContextSupport
java.lang.Object
org.springframework.core.AttributeAccessorSupport
org.springframework.retry.context.RetryContextSupport
- All Implemented Interfaces:
Serializable,org.springframework.core.AttributeAccessor,RetryContext
public class RetryContextSupport
extends org.springframework.core.AttributeAccessorSupport
implements RetryContext
- Author:
- Dave Syer
- See Also:
-
Field Summary
Fields inherited from interface org.springframework.retry.RetryContext
CLOSED, EXHAUSTED, MAX_ATTEMPTS, NAME, NO_RECOVERY, RECOVERED, STATE_KEY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAccessor for the exception object that caused the current retry.Accessor for the parent context if retry blocks are nested.intCounts the number of retry attempts.booleanPublic accessor for the exhausted flagRetryContext.setExhaustedOnly().voidregisterThrowable(Throwable throwable) Set the exception for the public interfaceRetryContext, and also increment the retry count if the throwable is non-null.voidSignal to the framework that no more attempts should be made to try or retry the currentRetryCallback.toString()Methods inherited from class org.springframework.core.AttributeAccessorSupport
attributeNames, computeAttribute, copyAttributesFrom, equals, getAttribute, hasAttribute, hashCode, removeAttribute, setAttributeMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.springframework.core.AttributeAccessor
attributeNames, computeAttribute, getAttribute, hasAttribute, removeAttribute, setAttribute
-
Constructor Details
-
RetryContextSupport
-
-
Method Details
-
getParent
Description copied from interface:RetryContextAccessor for the parent context if retry blocks are nested.- Specified by:
getParentin interfaceRetryContext- Returns:
- the parent or null if there is none.
-
isExhaustedOnly
public boolean isExhaustedOnly()Description copied from interface:RetryContextPublic accessor for the exhausted flagRetryContext.setExhaustedOnly().- Specified by:
isExhaustedOnlyin interfaceRetryContext- Returns:
- true if the flag has been set.
-
setExhaustedOnly
public void setExhaustedOnly()Description copied from interface:RetryContextSignal to the framework that no more attempts should be made to try or retry the currentRetryCallback.- Specified by:
setExhaustedOnlyin interfaceRetryContext
-
getRetryCount
public int getRetryCount()Description copied from interface:RetryContextCounts the number of retry attempts. Before the first attempt this counter is zero, and before the first and subsequent attempts it should increment accordingly.- Specified by:
getRetryCountin interfaceRetryContext- Returns:
- the number of retries.
-
getLastThrowable
Description copied from interface:RetryContextAccessor for the exception object that caused the current retry.- Specified by:
getLastThrowablein interfaceRetryContext- Returns:
- the last exception that caused a retry, or possibly null. It will be null if this is the first attempt and it finishes successfully, but also if the enclosing policy decides not to provide it (e.g. because of concerns about memory usage).
-
registerThrowable
Set the exception for the public interfaceRetryContext, and also increment the retry count if the throwable is non-null. AllRetryPolicyimplementations should use this method when they register the throwable. It should only be called once per retry attempt because it increments a counter. Use of this method is not enforced by the framework - it is a service provider contract for authors of policies.- Parameters:
throwable- the exception that caused the current retry attempt to fail.
-
toString
-