Package com.hazelcast.jet.retry
Interface IntervalFunction
-
- All Superinterfaces:
java.io.Serializable
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface IntervalFunction extends java.io.Serializable
Function that computes the wait time necessary for each subsequent retry attempt. The input is the sequence number of the attempt (1 = first failed attempt, 2 = second failed attempt and so on), the output is the wait time in milliseconds.- Since:
- Jet 4.3
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static IntervalFunction
constant(long intervalMs)
Creates anIntervalFunction
which returns a fixed interval in milliseconds.static IntervalFunction
exponentialBackoff(long intervalMillis, double multiplier)
Creates anIntervalFunction
which starts from the specified wait interval, on the first attempt, and for each subsequent attempt uses a longer interval, equal to the previous wait duration multiplied by the provided scaling factor (so for example: 1, 2, 4, 8, ...).static IntervalFunction
exponentialBackoffWithCap(long intervalMillis, double multiplier, long capMillis)
Creates anIntervalFunction
which starts from the specified wait interval, on the first attempt, and for each subsequent attempt uses a longer interval, equal to the previous wait duration multiplied by the provided scaling factor (so for example: 1, 2, 4, 8, ...).long
waitAfterAttempt(int attempt)
Returns the wait time required before the specified attempt.
-
-
-
Method Detail
-
constant
static IntervalFunction constant(long intervalMs)
Creates anIntervalFunction
which returns a fixed interval in milliseconds.
-
exponentialBackoff
static IntervalFunction exponentialBackoff(long intervalMillis, double multiplier)
Creates anIntervalFunction
which starts from the specified wait interval, on the first attempt, and for each subsequent attempt uses a longer interval, equal to the previous wait duration multiplied by the provided scaling factor (so for example: 1, 2, 4, 8, ...).
-
exponentialBackoffWithCap
static IntervalFunction exponentialBackoffWithCap(long intervalMillis, double multiplier, long capMillis)
Creates anIntervalFunction
which starts from the specified wait interval, on the first attempt, and for each subsequent attempt uses a longer interval, equal to the previous wait duration multiplied by the provided scaling factor (so for example: 1, 2, 4, 8, ...). The wait interval increases only until a certain maximum value, ie. is capped. All subsequent wait intervals returned will be equal to the cap.
-
waitAfterAttempt
long waitAfterAttempt(int attempt)
Returns the wait time required before the specified attempt. In this context attempt no. 1 means the first attempt, so it's not an index and zero is not an allowed input.
-
-