Class BeforeRetryExponentialBackoffTask

java.lang.Object
io.atlassian.fugue.retry.BeforeRetryExponentialBackoffTask
All Implemented Interfaces:
Runnable

public class BeforeRetryExponentialBackoffTask extends Object implements Runnable
A backoff task for use in a retry -function, -supplier, or -task. This should be used as the beforeRetry hook. Upon each execution, the amount of time to wait before retrying the function call is doubled. This class maintains an internal state; we recommend creating a new instance for each use.
  • Field Details

    • backoff

      private long backoff
  • Constructor Details

    • BeforeRetryExponentialBackoffTask

      public BeforeRetryExponentialBackoffTask(long backoffMillis)

      Constructor for BeforeRetryExponentialBackoffTask.

      Parameters:
      backoffMillis - the amount of time to wait, in milliseconds before retrying the first time. This is doubled for each subsequent retry. This parameter must be above zero.
  • Method Details

    • run

      public void run()
      This method causes the current thread to sleep for a duration which doubles after each successive call. InterruptedExceptions are wrapped before being rethrown in a RuntimeException.
      Specified by:
      run in interface Runnable
    • currentBackoff

      long currentBackoff()