Interface Retry.RetryPolicy

All Known Implementing Classes:
Retry.DelayingRetryPolicy, Retry.ExponentialRetryPolicy, Retry.FibonacciRetryPolicy, Retry.JitterRetryPolicy
Enclosing interface:
Retry

public static interface Retry.RetryPolicy
Retry policy to handle delays between retries. The implementation must not save state, as a single instance will be used by multiple threads and executions in parallel.
  • Method Summary

    Modifier and Type
    Method
    Description
    nextDelayMillis(long firstCallMillis, long lastDelay, int call)
    Return next delay in milliseconds, or an empty optional to finish retries.
  • Method Details

    • nextDelayMillis

      Optional<Long> nextDelayMillis(long firstCallMillis, long lastDelay, int call)
      Return next delay in milliseconds, or an empty optional to finish retries.
      Parameters:
      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)
      Returns:
      how long to wait before trying again, or empty to notify this is the end of retries