com.netflix.curator.retry
Class ExponentialBackoffRetry
java.lang.Object
com.netflix.curator.retry.ExponentialBackoffRetry
- All Implemented Interfaces:
- RetryPolicy
public class ExponentialBackoffRetry
- extends Object
Retry policy that retries a set number of times with increasing sleep time between retries
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ExponentialBackoffRetry
public ExponentialBackoffRetry(int baseSleepTimeMs,
int maxRetries)
- Parameters:
baseSleepTimeMs - initial amount of time to wait between retriesmaxRetries - max number of times to retry
getBaseSleepTimeMs
public int getBaseSleepTimeMs()
getSleepTimeMs
protected int getSleepTimeMs(int retryCount,
long elapsedTimeMs)
getN
public int getN()
allowRetry
public boolean allowRetry(int retryCount,
long elapsedTimeMs)
- Description copied from interface:
RetryPolicy
- Called when an operation has failed for some reason. This method should return
true to make another attempt.
- Specified by:
allowRetry in interface RetryPolicy
- Parameters:
retryCount - the number of times retried so far (0 the first time)elapsedTimeMs - the elapsed time in ms since the operation was attempted
- Returns:
- true/false
Copyright © 2012. All Rights Reserved.