Interface RetryStrategy

All Superinterfaces:
Serializable

public interface RetryStrategy
extends Serializable
Description of a strategy to take when an action fails, like when connecting to a server. An example strategy for this scenario can be: "attempt to reconnect 3 times, wait 5 seconds between each attempt, if all of them fail, give up".

The lifecycle of a retry strategy begins whenever an action fails and ends in one of two ways: either a retry of the action is successful (for example reconnection attempt to a server succeeds) or the strategy gives up (for example it did a specified maximum number of retries, all of them failed).

Since:
4.3
  • Method Summary

    Modifier and Type Method Description
    IntervalFunction getIntervalFunction()
    Function specifying how much time to wait before each retry attempt.
    int getMaxAttempts()
    Maximum number of retry attempt that should be made before giving up.
  • Method Details

    • getMaxAttempts

      int getMaxAttempts()
      Maximum number of retry attempt that should be made before giving up.

      A value of 0 should be interpreted as "never retry". Action is performed once.

      A negative value is interpreted as "retry indefinitely, until success".

    • getIntervalFunction

      IntervalFunction 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.