Package org.apache.curator.retry
Class RetryNTimes
- java.lang.Object
-
- org.apache.curator.retry.RetryNTimes
-
- All Implemented Interfaces:
RetryPolicy
- Direct Known Subclasses:
RetryOneTime
public class RetryNTimes extends java.lang.ObjectRetry policy that retries a max number of times
-
-
Constructor Summary
Constructors Constructor Description RetryNTimes(int n, int sleepMsBetweenRetries)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanallowRetry(int retryCount, long elapsedTimeMs, RetrySleeper sleeper)Called when an operation has failed for some reason.intgetN()protected longgetSleepTimeMs(int retryCount, long elapsedTimeMs)
-
-
-
Method Detail
-
getSleepTimeMs
protected long getSleepTimeMs(int retryCount, long elapsedTimeMs)
-
getN
public int getN()
-
allowRetry
public boolean allowRetry(int retryCount, long elapsedTimeMs, RetrySleeper sleeper)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
-
-