Package org.apache.curator.retry
Class BoundedExponentialBackoffRetry
java.lang.Object
org.apache.curator.retry.ExponentialBackoffRetry
org.apache.curator.retry.BoundedExponentialBackoffRetry
- All Implemented Interfaces:
RetryPolicy
Retry policy that retries a set number of times with an increasing (up to a maximum bound) sleep time between retries
-
Constructor Summary
ConstructorsConstructorDescriptionBoundedExponentialBackoffRetry(int baseSleepTimeMs, int maxSleepTimeMs, int maxRetries) -
Method Summary
Modifier and TypeMethodDescriptionbooleanallowRetry(int retryCount, long elapsedTimeMs, RetrySleeper sleeper) Called when an operation has failed for some reason.intintgetN()protected longgetSleepTimeMs(int retryCount, long elapsedTimeMs) Methods inherited from class org.apache.curator.retry.ExponentialBackoffRetry
getBaseSleepTimeMsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.curator.RetryPolicy
allowRetry
-
Constructor Details
-
BoundedExponentialBackoffRetry
public BoundedExponentialBackoffRetry(int baseSleepTimeMs, int maxSleepTimeMs, int maxRetries) - Parameters:
baseSleepTimeMs- initial amount of time to wait between retriesmaxSleepTimeMs- maximum amount of time to wait between retriesmaxRetries- maximum number of times to retry
-
-
Method Details
-
getMaxSleepTimeMs
public int getMaxSleepTimeMs() -
getSleepTimeMs
protected long getSleepTimeMs(int retryCount, long elapsedTimeMs) - Overrides:
getSleepTimeMsin classExponentialBackoffRetry
-
getN
public int getN() -
allowRetry
Description copied from interface:RetryPolicyCalled when an operation has failed for some reason. This method should return true to make another attempt.- Specified by:
allowRetryin interfaceRetryPolicy- Parameters:
retryCount- the number of times retried so far (0 the first time)elapsedTimeMs- the elapsed time in ms since the operation was attemptedsleeper- use this to sleep - DO NOT call Thread.sleep- Returns:
- true/false
-