Package org.redisson.config
Class EqualJitterDelay
java.lang.Object
org.redisson.config.EqualJitterDelay
- All Implemented Interfaces:
DelayStrategy
Equal jitter strategy that introduces moderate randomness while maintaining some stability of delay value.
This strategy keeps half of the exponential backoff delay and adds a random component
for the other half. The resulting delay is between backoff/2 and backoff, providing
a balance between predictability and randomness.
- Author:
- Nikita Koksharov
-
Constructor Summary
ConstructorsConstructorDescriptionEqualJitterDelay(Duration baseDelay, Duration maxDelay) Creates an equal jitter delay strategy with exponential backoff. -
Method Summary
Modifier and TypeMethodDescriptioncalcDelay(int attempt) Calculates the delay duration to wait before the next retry attempt.
-
Constructor Details
-
EqualJitterDelay
Creates an equal jitter delay strategy with exponential backoff.- Parameters:
baseDelay- the base delay duration for the first retry attemptmaxDelay- the maximum delay duration to cap the exponential growth
-
-
Method Details
-
calcDelay
Description copied from interface:DelayStrategyCalculates the delay duration to wait before the next retry attempt.- Specified by:
calcDelayin interfaceDelayStrategy- Parameters:
attempt- the zero-based retry attempt number (0 = first retry)- Returns:
- the duration to wait before the next retry attempt
-
getBaseDelay
-
getMaxDelay
-