Annotation Type FibonacciBackoff


@Inherited @Documented @Retention(RUNTIME) @Target({METHOD,TYPE}) @Experimental("first attempt at providing additional retry backoff strategies") public @interface FibonacciBackoff
Modifies a @Retry annotation to use Fibonacci backoff instead of the default constant backoff. May only be present on elements that are also annotated @Retry.

Fibonacci backoff uses the initial delay before the first retry attempt, and then increases the delays per the Fibonacci sequence. The first few delays are: initial delay, 2 * initial delay, 3 * initial delay, 5 * initial delay, 8 * initial delay, 13 * initial delay, etc. (Additionally, jitter will be applied to each value.) To prevent unbounded growth of these delays, maxDelay() should be configured.

All configuration options of @Retry still apply and all their constraints are still enforced. Additionally:

  • delay, delayUnit: is used as an initial delay, before the first retry attempt. Must be less than maxDelay(). Note that if 0, Fibonacci backoff degenerates to zero backoff.
See Also:
  • Element Details

    • maxDelay

      long maxDelay
      The maximum delay between retries. Defaults to 1 minute. The value must be greater than or equal to 0, and must be less than Retry.maxDuration. 0 means not set.

      Note that this is different from maxDuration. This places a limit on each individual delay between retries, while maxDuration places a limit on the total time all retries may take.

      Returns:
      the max delay time
      Default:
      60000L
    • maxDelayUnit

      ChronoUnit maxDelayUnit
      The unit for maxDelay(). Defaults to ChronoUnit.MILLIS.
      Returns:
      the max delay unit
      Default:
      MILLIS