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:
  • Constructor Details

    • RetryContextSupport

      public RetryContextSupport(RetryContext parent)
  • Method Details

    • getParent

      public RetryContext getParent()
      Description copied from interface: RetryContext
      Accessor for the parent context if retry blocks are nested.
      Specified by:
      getParent in interface RetryContext
      Returns:
      the parent or null if there is none.
    • isExhaustedOnly

      public boolean isExhaustedOnly()
      Description copied from interface: RetryContext
      Public accessor for the exhausted flag RetryContext.setExhaustedOnly().
      Specified by:
      isExhaustedOnly in interface RetryContext
      Returns:
      true if the flag has been set.
    • setExhaustedOnly

      public void setExhaustedOnly()
      Description copied from interface: RetryContext
      Signal to the framework that no more attempts should be made to try or retry the current RetryCallback.
      Specified by:
      setExhaustedOnly in interface RetryContext
    • getRetryCount

      public int getRetryCount()
      Description copied from interface: RetryContext
      Counts 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:
      getRetryCount in interface RetryContext
      Returns:
      the number of retries.
    • getLastThrowable

      public Throwable getLastThrowable()
      Description copied from interface: RetryContext
      Accessor for the exception object that caused the current retry.
      Specified by:
      getLastThrowable in interface RetryContext
      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

      public void registerThrowable(Throwable throwable)
      Set the exception for the public interface RetryContext, and also increment the retry count if the throwable is non-null. All RetryPolicy implementations 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

      public String toString()
      Overrides:
      toString in class Object