Interface RetryState


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

      • canRetry

        boolean canRetry​(java.lang.Throwable exception)
        Should a retry attempt 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

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

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

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

        java.util.Optional<java.time.Duration> getMaxDelay()
        Returns:
        The maximum overall delay
      • getRetryPredicate

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

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

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

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