Interface RetryState


public interface RetryState
An interface that encapsulates the current state of a Retryable operation.
Since:
1.0
Author:
graemerocher
  • Method Details

    • canRetry

      boolean canRetry(Throwable exception)
      Should a retry attempt to occur.
      Parameters:
      exception - The error
      Returns:
      True if it should
    • getMaxAttempts

      int getMaxAttempts()
      Returns:
      The maximum number of attempts
    • currentAttempt

      int currentAttempt()
      Returns:
      The number of the current attempt
    • getMultiplier

      OptionalDouble getMultiplier()
      Returns:
      The multiplier to use between delays
    • getDelay

      Duration getDelay()
      Returns:
      The delay between attempts
    • getOverallDelay

      Duration getOverallDelay()
      Returns:
      The overall delay so far
    • getMaxDelay

      Optional<Duration> getMaxDelay()
      Returns:
      The maximum overall delay
    • getRetryPredicate

      default RetryPredicate getRetryPredicate()
      Returns:
      The retry predicate checking for includes/excludes throwable classes
    • getCapturedException

      Class<? extends Throwable> getCapturedException()
      Returns:
      The captured exception type (default to RuntimeException
    • open

      default void open()
      Opens the retry state.
    • close

      default void close(@Nullable @Nullable Throwable exception)
      Closes the RetryState.
      Parameters:
      exception - An exception if an error occurred or null if the operation completed as expected