Package alluxio.retry

Class TimeoutRetry

  • All Implemented Interfaces:
    RetryPolicy

    @NotThreadSafe
    public class TimeoutRetry
    extends java.lang.Object
    implements RetryPolicy
    A retry policy which allows retrying until a specified timeout is reached.
    • Constructor Summary

      Constructors 
      Constructor Description
      TimeoutRetry​(long retryTimeoutMs, int sleepMs)
      Constructs a retry facility which allows retrying until a specified timeout is reached.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean attempt()
      Waits until it is time to perform the next retry, then returns.
      int getAttemptCount()
      How many retries have been performed.
      • Methods inherited from class java.lang.Object

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

      • TimeoutRetry

        public TimeoutRetry​(long retryTimeoutMs,
                            int sleepMs)
        Constructs a retry facility which allows retrying until a specified timeout is reached.
        Parameters:
        retryTimeoutMs - maximum period of time to retry for, in milliseconds
        sleepMs - time in milliseconds to sleep before retrying
    • Method Detail

      • getAttemptCount

        public int getAttemptCount()
        Description copied from interface: RetryPolicy
        How many retries have been performed. If no retries have been performed, 0 is returned.
        Specified by:
        getAttemptCount in interface RetryPolicy
        Returns:
        number of retries performed
      • attempt

        public boolean attempt()
        Description copied from interface: RetryPolicy
        Waits until it is time to perform the next retry, then returns. Returns false if no further retries should be performed. The first call to this method should never delay the caller, this allow users of the policy to use it in the context of a while-loop.
        Specified by:
        attempt in interface RetryPolicy
        Returns:
        whether another retry should be performed