- All Superinterfaces:
public interface RetryStrategy extends Serializable
Description of a strategy to be followed when retrying a failed action, like connecting to a server. A typical strategy for this scenario could be for example: "attempt to reconnect 3 times, wait 5 seconds between each attempt, if all of them fail, then give up".
The lifecycle of a retry strategy begins whenever its covered action fails and ends in one of two ways: either a retry of the action is successful (the action is successfully undertaken, for example reconnect to a server succeeds) or the strategy gives up (for example it had a specified maximum number of retries, all of them had been attempted and none was successful).
Modifier and Type Method Description
getIntervalFunction()Function specifying how much time to wait before each retry attempt.
getMaxAttempts()Maximum number of retry attempt that should be made before giving up.
getMaxAttemptsint getMaxAttempts()Maximum number of retry attempt that should be made before giving up.
A value of 0 should be interpreted as "give up on first failure, without any retries".
A negative value should be interpreted as "retry indefinitely, until success".
getIntervalFunctionIntervalFunction getIntervalFunction()Function specifying how much time to wait before each retry attempt. Can specify a constant wait time, exponential backoff or any other, arbitrarily complex wait strategy.