Package io.micronaut.retry
Interface RetryState
public interface RetryState
An interface that encapsulates the current state of a
Retryable
operation.- Since:
- 1.0
- Author:
- graemerocher
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Should a retry attempt to occur.default void
Closes theRetryState
.int
getDelay()
int
default RetryPredicate
default void
open()
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
-
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
- Returns:
- The maximum overall delay
-
getRetryPredicate
- Returns:
- The retry predicate checking for includes/excludes throwable classes
-
getCapturedException
- Returns:
- The captured exception type (default to
RuntimeException
-
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
-