org.apache.curator.retry
Class RetryUntilElapsed
java.lang.Object
org.apache.curator.retry.RetryUntilElapsed
- All Implemented Interfaces:
- RetryPolicy
public class RetryUntilElapsed
- extends Object
A retry policy that retries until a given amount of time elapses
Constructor Summary |
RetryUntilElapsed(int maxElapsedTimeMs,
int sleepMsBetweenRetries)
|
Method Summary |
boolean |
allowRetry(int retryCount,
long elapsedTimeMs,
RetrySleeper sleeper)
Called when an operation has failed for some reason. |
int |
getN()
|
protected int |
getSleepTimeMs(int retryCount,
long elapsedTimeMs)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
RetryUntilElapsed
public RetryUntilElapsed(int maxElapsedTimeMs,
int sleepMsBetweenRetries)
allowRetry
public boolean allowRetry(int retryCount,
long elapsedTimeMs,
RetrySleeper sleeper)
- 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 attemptedsleeper
- use this to sleep - DO NOT call Thread.sleep
- Returns:
- true/false
getSleepTimeMs
protected int getSleepTimeMs(int retryCount,
long elapsedTimeMs)
getN
public int getN()
Copyright © 2011–2014 The Apache Software Foundation. All rights reserved.