Annotation Interface Ft.Retry

Enclosing class:
Ft

@Retention(CLASS) @Documented @Intercepted public static @interface Ft.Retry
The annotated method (or all methods on annotated type) will be retried according to the configuration.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Class<? extends Throwable>[]
    These throwables will be considered retriable.
    int
    Number of calls (first try + retries).
    Duration to delay Defaults to 200 milliseconds.
    double
    Delay retry policy factor.
    Random jitter applied to the delay.
    double
    Random jitter relative to the calculated delay, from 0 (inclusive) to 1 (exclusive).
    Maximum delay between invocation attempts, including jitter.
    If named, an attempt will be made to find a named Retry instance in service registry.
    Duration of overall timeout.
    Class<? extends Throwable>[]
    These throwables will not be considered retriable, all other will.
  • Element Details

    • name

      String name
      If named, an attempt will be made to find a named Retry instance in service registry. If not found, a new retry will be created based on values on this annotation.
      Returns:
      name of this retry
      Default:
      ""
    • calls

      int calls
      Number of calls (first try + retries).
      Returns:
      number of desired calls, must be 1 (means no retries) or higher.
      Default:
      3
    • delay

      String delay
      Duration to delay Defaults to 200 milliseconds.
      Returns:
      duration to delay, such as PT1S (1 second)
      See Also:
      Default:
      "PT0.2S"
    • delayFactor

      double delayFactor
      Delay retry policy factor. If unspecified (value of -1), a factor of 2 is used unless jitter is configured, in which case the delay remains constant.

      When both this option and jitter() are configured, the delay factor is applied first and jitter is applied independently to the resulting delay. A jittered delay does not affect later base-delay calculations.

      Returns:
      delay factor for delaying retry policy
      Default:
      -1.0
    • jitter

      String jitter
      Random jitter applied to the delay. If unspecified (value of PT-1S), jitter is not applied. When both this option and delayFactor() are configured, the delay factor is applied first and jitter is applied independently to the resulting delay. A jittered delay does not affect later base-delay calculations. The final delay is capped by maxDelay(), when configured.
      Returns:
      jitter duration
      See Also:
      Default:
      "PT-1S"
    • jitterFactor

      double jitterFactor
      Random jitter relative to the calculated delay, from 0 (inclusive) to 1 (exclusive). For example, a value of 0.2 applies a random jitter of up to twenty percent in either direction. This option cannot be combined with an explicitly configured absolute jitter. Each retry applies relative jitter independently, and a jittered delay does not affect later base-delay calculations. A value of -1 means relative jitter is not configured.
      Returns:
      relative jitter factor
      Default:
      -1.0
    • maxDelay

      String maxDelay
      Maximum delay between invocation attempts, including jitter. If unspecified (value of PT-1S), the delay is not capped.
      Returns:
      maximum delay
      See Also:
      Default:
      "PT-1S"
    • overallTimeout

      String overallTimeout
      Duration of overall timeout. Defaults to PT1S (1 second).
      Returns:
      duration of overall timeout
      Default:
      "PT1S"
    • applyOn

      Class<? extends Throwable>[] applyOn
      These throwables will be considered retriable.
      Returns:
      throwable classes to trigger retries
      See Also:
      Default:
      {}
    • skipOn

      Class<? extends Throwable>[] skipOn
      These throwables will not be considered retriable, all other will.
      Returns:
      throwable classes to skip retries
      See Also:
      Default:
      {}