public class RetryNTimes
extends java.lang.Object
Constructor and Description |
---|
RetryNTimes(int n,
int sleepMsBetweenRetries) |
Modifier and Type | Method and Description |
---|---|
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) |
protected int getSleepTimeMs(int retryCount, long elapsedTimeMs)
public int getN()
public boolean allowRetry(int retryCount, long elapsedTimeMs, RetrySleeper sleeper)
RetryPolicy
allowRetry
in interface RetryPolicy
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