Class BackoffStrategy


  • public class BackoffStrategy
    extends Object
    • Constructor Detail

      • BackoffStrategy

        public BackoffStrategy​(int initial,
                               int exponent,
                               int interval)
        Constructs an exponential backoff counter.
        Parameters:
        initial - The initial integer to start the counter with
        exponent - The exponent by which to increase the counter value with on each call to next()
        interval - The maximum time between retries in seconds
    • Method Detail

      • next

        public int next()
        Returns:
        The current value of the counter and immediately updates it with the next value
      • peek

        public int peek()
        Returns:
        The current value of the counter without updating it