public class BoundedExponentialBackoffRetry extends ExponentialBackoffRetry
Constructor and Description |
---|
BoundedExponentialBackoffRetry(int baseSleepTimeMs,
int maxSleepTimeMs,
int maxRetries) |
Modifier and Type | Method and Description |
---|---|
boolean |
allowRetry(int retryCount,
long elapsedTimeMs,
RetrySleeper sleeper)
Called when an operation has failed for some reason.
|
int |
getMaxSleepTimeMs() |
int |
getN() |
protected long |
getSleepTimeMs(int retryCount,
long elapsedTimeMs) |
getBaseSleepTimeMs
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
allowRetry
public BoundedExponentialBackoffRetry(int baseSleepTimeMs, int maxSleepTimeMs, int maxRetries)
baseSleepTimeMs
- initial amount of time to wait between retriesmaxSleepTimeMs
- maximum amount of time to wait between retriesmaxRetries
- maximum number of times to retrypublic int getMaxSleepTimeMs()
protected long getSleepTimeMs(int retryCount, long elapsedTimeMs)
getSleepTimeMs
in class ExponentialBackoffRetry
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.sleepCopyright © 2011–2023 The Apache Software Foundation. All rights reserved.