Interface Delay
- All Known Implementing Classes:
Blended,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:
Constant,Exponential,MultipleOf,ShiftByMultipleOf
-
Method Summary
Modifier and Type Method Description java.time.DurationnextDelay(int attempt)Returns the new delay amount to stabilize as defined byDurationtime.
-
Method Details
-
nextDelay
java.time.Duration nextDelay(int attempt)Returns the new delay amount to stabilize as defined byDurationtime. 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.ZEROto indicate delay is complete
-