Interface RetryState

All Known Implementing Classes:
RetryException

public interface RetryState
A representation of the current retry state, including the current retry count and the exceptions accumulated so far.

Used as a parameter for RetryListener.onRetryableExecution(RetryPolicy, Retryable, RetryState). Implemented by RetryException as well, exposing the final outcome in the terminal listener methods RetryListener.onRetryPolicyExhaustion(RetryPolicy, Retryable, RetryException), RetryListener.onRetryPolicyInterruption(RetryPolicy, Retryable, RetryException) and RetryListener.onRetryPolicyTimeout(RetryPolicy, Retryable, RetryException).

Since:
7.0.2
Author:
Juergen Hoeller
  • Method Summary

    Modifier and Type
    Method
    Description
    Return the invocation exceptions accumulated so far, in the order of occurrence.
    default Throwable
    Return the recorded exception from the last invocation.
    int
    Return the current retry count: 0 indicates the initial invocation, 1 the first retry attempt, etc.
    default boolean
    Indicate whether a successful invocation has been accomplished.
  • Method Details

    • getRetryCount

      int getRetryCount()
      Return the current retry count: 0 indicates the initial invocation, 1 the first retry attempt, etc.

      This may indicate the current attempt or the final number of retry attempts, depending on the time of the method call.

    • getExceptions

      List<Throwable> getExceptions()
      Return the invocation exceptions accumulated so far, in the order of occurrence.
    • getLastException

      default Throwable getLastException()
      Return the recorded exception from the last invocation.
      Throws:
      IllegalStateException - if no exception has been recorded
    • isSuccessful

      default boolean isSuccessful()
      Indicate whether a successful invocation has been accomplished.