Interface Delay

All Known Implementing Classes:
Blended, CappedExponential, Constant, Exponential, MultipleOf, ShiftByMultipleOf

public interface Delay
This interface defines the Delay that you needed between invocations of a specific call chain. Provides a simple interface to define different types of delay implementations like Constant, Exponential. Constant, provides the Constant.nextDelay(int) that waves constantly for the next attempt. When it exceeds Constant#timeout it return Duration.ZERO to indicate end of delay. Exponential, provide exponential values between [Exponential#minDelay, Exponential#timeout
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    nextDelay(int attempt)
    Returns the new delay amount to stabilize as defined by Duration time.
  • Method Details

    • nextDelay

      Duration nextDelay(int attempt)
      Returns the new delay amount to stabilize as defined by Duration time. This returns -1 to indicate that we are done with delays from this instance Different implementations can return different values
      Parameters:
      attempt - , starts with 1
      Returns:
      the next amount to wait for or Duration.ZERO to indicate delay is complete