Class BackOffUtils


  • public final class BackOffUtils
    extends java.lang.Object
    Utilities for BackOff.

    Note: This is copied from Google API client library to avoid its dependency.

    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean next​(Sleeper sleeper, BackOff backOff)
      Runs the next iteration of the back-off policy, and returns whether to continue to retry the operation.
      • Methods inherited from class java.lang.Object

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

      • next

        public static boolean next​(Sleeper sleeper,
                                   BackOff backOff)
                            throws java.lang.InterruptedException,
                                   java.io.IOException
        Runs the next iteration of the back-off policy, and returns whether to continue to retry the operation.

        If true, it will call Sleeper.sleep(long) with the specified number of milliseconds from BackOff.nextBackOffMillis().

        Parameters:
        sleeper - sleeper
        backOff - back-off policy
        Returns:
        whether to continue to back off; in other words, whether BackOff.nextBackOffMillis() did not return BackOff.STOP
        Throws:
        java.lang.InterruptedException - if any thread has interrupted the current thread
        java.io.IOException