Class DefaultRetryState

java.lang.Object
org.springframework.retry.support.DefaultRetryState
All Implemented Interfaces:
RetryState

public class DefaultRetryState extends Object implements RetryState
Author:
Dave Syer
  • Constructor Details

  • Method Details

    • getKey

      public Object getKey()
      Description copied from interface: RetryState
      Key representing the state for a retry attempt. Stateful retry is characterised by having to recognise the items that are being processed, so this value is used as a cache key in between failed attempts.
      Specified by:
      getKey in interface RetryState
      Returns:
      the key that this state represents
    • isForceRefresh

      public boolean isForceRefresh()
      Description copied from interface: RetryState
      Indicate whether a cache lookup can be avoided. If the key is known ahead of the retry attempt to be fresh (i.e. has never been seen before) then a cache lookup can be avoided if this flag is true.
      Specified by:
      isForceRefresh in interface RetryState
      Returns:
      true if the state does not require an explicit check for the key
    • rollbackFor

      public boolean rollbackFor(Throwable exception)
      Description copied from interface: RetryState
      Check whether this exception requires a rollback. The default is always true, which is conservative, so this method provides an optimisation for switching to stateless retry if there is an exception for which rollback is unnecessary. Example usage would be for a stateful retry to specify a validation exception as not for rollback.
      Specified by:
      rollbackFor in interface RetryState
      Parameters:
      exception - the exception that caused a retry attempt to fail
      Returns:
      true if this exception should cause a rollback
    • toString

      public String toString()
      Overrides:
      toString in class Object