Interface RetryState
- All Known Subinterfaces:
MutableRetryState
- All Known Implementing Classes:
CircuitBreakerRetry
public interface RetryState
An interface that encapsulates the current state of a
Retryable operation.- Since:
- 1.0
- Author:
- graemerocher
-
Method Summary
Modifier and TypeMethodDescriptionbooleanShould a retry attempt to occur.default voidCloses theRetryState.intReturns the number of the current attempt.Returns the captured exception type, which defaults toException.getDelay()Returns the delay between attempts.default OptionalDoubleReturns the jitter factor used to apply random deviation to retry delays.intReturns the maximum number of attempts.Returns the maximum overall delay.Returns the multiplier to use between delays.Returns the overall delay so far.default RetryPredicateReturns the retry predicate checking for includes and excludes throwable classes.default voidopen()Opens the retry state.
-
Method Details
-
canRetry
Should a retry attempt to occur.- Parameters:
exception- The error- Returns:
- True if it should
-
getMaxAttempts
int getMaxAttempts()Returns the maximum number of attempts.- Returns:
- The maximum number of attempts
-
currentAttempt
int currentAttempt()Returns the number of the current attempt.- Returns:
- The number of the current attempt
-
getMultiplier
OptionalDouble getMultiplier()Returns the multiplier to use between delays.- Returns:
- The multiplier to use between delays
-
getDelay
-
getOverallDelay
-
getMaxDelay
-
getJitter
Returns the jitter factor used to apply random deviation to retry delays.- Returns:
- The jitter factor used to apply random deviation to retry delays
-
getRetryPredicate
Returns the retry predicate checking for includes and excludes throwable classes.- Returns:
- The retry predicate checking for includes and excludes throwable classes
-
getCapturedException
-
open
default void open()Opens the retry state. -
close
Closes theRetryState.- Parameters:
exception- An exception if an error occurred or null if the operation completed as expected
-