Class BeforeRetryLinearBackoffTask

  • All Implemented Interfaces:
    java.lang.Runnable

    public class BeforeRetryLinearBackoffTask
    extends java.lang.Object
    implements java.lang.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 current thread sleeps for the time specified at construction. This class is thread safe and contains no internal state, hence instances can be reused and the same instance can be used on multiple threads.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private long backoff  
    • Constructor Summary

      Constructors 
      Constructor Description
      BeforeRetryLinearBackoffTask​(long backoffMillis)
      Constructor for BeforeRetryLinearBackoffTask.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) long currentBackoff()  
      void run()
      This method causes the current thread to sleep for the time specified when the instance is constructed.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • backoff

        private final long backoff
    • Constructor Detail

      • BeforeRetryLinearBackoffTask

        public BeforeRetryLinearBackoffTask​(long backoffMillis)

        Constructor for BeforeRetryLinearBackoffTask.

        Parameters:
        backoffMillis - the time to wait whenever run is executed
    • Method Detail

      • run

        public void run()
        This method causes the current thread to sleep for the time specified when the instance is constructed. InterruptedExceptions are wrapped before being rethrown in a RuntimeException.
        Specified by:
        run in interface java.lang.Runnable
      • currentBackoff

        long currentBackoff()