Enum Class JitterStrategy
- All Implemented Interfaces:
Serializable,Comparable<JitterStrategy>,Constable
Jitter strategy for retry delays to prevent thundering herd problems.
Jitter reduces simultaneous retry attempts by spreading retries out over a randomized delay interval, which helps prevent overwhelming services when many clients retry at the same time.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionabstract doubleapply(double baseDelay) static JitterStrategyReturns the enum constant of this class with the specified name.static JitterStrategy[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
NONE
No jitter - use exact calculated delay. This provides predictable timing but may cause thundering herd issues. -
FULL
Full jitter - random delay between 0 and calculated delay. This provides maximum spread but may result in very short delays. -
HALF
Half jitter - random delay between 50% and 100% of calculated delay. This provides good spread while maintaining reasonable minimum delays.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
apply
public abstract double apply(double baseDelay)
-