Package alluxio.retry
Class TimeBoundedRetry
- java.lang.Object
-
- alluxio.retry.TimeBoundedRetry
-
- All Implemented Interfaces:
RetryPolicy
- Direct Known Subclasses:
ExponentialTimeBoundedRetry
public abstract class TimeBoundedRetry extends java.lang.Object implements RetryPolicy
Retry mechanism which performs retries until a certain period of time has elapsed. Subclasses determine the interval between retries.
-
-
Constructor Summary
Constructors Constructor Description TimeBoundedRetry(TimeContext timeCtx, java.time.Duration maxDuration)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
attempt()
Waits until it is time to perform the next retry, then returns.protected abstract java.time.Duration
computeNextWaitTime()
int
getAttemptCount()
How many retries have been performed.
-
-
-
Constructor Detail
-
TimeBoundedRetry
public TimeBoundedRetry(TimeContext timeCtx, java.time.Duration maxDuration)
- Parameters:
timeCtx
- the time context to use for time-based operationsmaxDuration
- the maximum duration
-
-
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 interfaceRetryPolicy
- 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 interfaceRetryPolicy
- Returns:
- whether another retry should be performed
-
computeNextWaitTime
protected abstract java.time.Duration computeNextWaitTime()
- Returns:
- how long to wait before the next retry
-
-