Class EqualJitterDelay

java.lang.Object
org.redisson.config.EqualJitterDelay
All Implemented Interfaces:
DelayStrategy

public class EqualJitterDelay extends Object implements 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 Details

    • EqualJitterDelay

      public EqualJitterDelay(Duration baseDelay, Duration maxDelay)
      Creates an equal jitter delay strategy with exponential backoff.
      Parameters:
      baseDelay - the base delay duration for the first retry attempt
      maxDelay - the maximum delay duration to cap the exponential growth
  • Method Details

    • calcDelay

      public Duration calcDelay(int attempt)
      Description copied from interface: DelayStrategy
      Calculates the delay duration to wait before the next retry attempt.
      Specified by:
      calcDelay in interface DelayStrategy
      Parameters:
      attempt - the zero-based retry attempt number (0 = first retry)
      Returns:
      the duration to wait before the next retry attempt
    • getBaseDelay

      public Duration getBaseDelay()
    • getMaxDelay

      public Duration getMaxDelay()