Class Retry.FibonacciRetryPolicy

All Implemented Interfaces:
Enclosing interface:

public static class Retry.FibonacciRetryPolicy extends Object implements Retry.RetryPolicy
A retry policy that increases the delay time following the Fibonacci sequence. Allowed elements that are also annotated with @Retry. Expected sequence: initial delay, 2 * initial delay + jitter, 3 * initial delay + jitter, 5 * initial delay + jitter, etc. maxDelayInMillis is used to prevent endless waiting.
  • Method Details

    • builder

      public static Retry.FibonacciRetryPolicy.Builder builder()
      A new fluent API builder to configure instances of Retry.
      a new builder
    • nextDelayMillis

      public Optional<Long> nextDelayMillis(long firstCallMillis, long lastDelay, int call)
      Description copied from interface: Retry.RetryPolicy
      Return next delay in milliseconds, or an empty optional to finish retries.
      Specified by:
      nextDelayMillis in interface Retry.RetryPolicy
      firstCallMillis - milliseconds recorded before the first call using System.currentTimeMillis()
      lastDelay - last delay that was used (0 for the first failed call)
      call - call index (0 for the first failed call)
      how long to wait before trying again, or empty to notify this is the end of retries