public class UniformRandomBackOffPolicy extends StatelessBackOffPolicy implements SleepingBackOffPolicy<UniformRandomBackOffPolicy>
BackOffPolicy that pauses for a random period of
time before continuing. A pause is implemented using Sleeper.sleep(long).
setMinBackOffPeriod(long) is thread-safe and it is safe to call
setMaxBackOffPeriod(long) during execution from multiple threads, however
this may cause a single retry operation to have pauses of different
intervals.| Constructor and Description |
|---|
UniformRandomBackOffPolicy() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
doBackOff()
Pause for the
setMinBackOffPeriod(long). |
long |
getMaxBackOffPeriod()
The maximum backoff period in milliseconds.
|
long |
getMinBackOffPeriod()
The minimum backoff period in milliseconds.
|
void |
setMaxBackOffPeriod(long backOffPeriod)
Set the maximum back off period in milliseconds.
|
void |
setMinBackOffPeriod(long backOffPeriod)
Set the minimum back off period in milliseconds.
|
void |
setSleeper(Sleeper sleeper)
Public setter for the
Sleeper strategy. |
String |
toString() |
UniformRandomBackOffPolicy |
withSleeper(Sleeper sleeper)
Clone the policy and return a new policy which uses the passed sleeper.
|
backOff, startclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitbackOff, startpublic UniformRandomBackOffPolicy withSleeper(Sleeper sleeper)
SleepingBackOffPolicywithSleeper in interface SleepingBackOffPolicy<UniformRandomBackOffPolicy>sleeper - Target to be invoked any time the backoff policy sleepspublic void setSleeper(Sleeper sleeper)
Sleeper strategy.sleeper - the sleeper to set defaults to ThreadWaitSleeper.public void setMinBackOffPeriod(long backOffPeriod)
backOffPeriod - the backoff periodpublic long getMinBackOffPeriod()
public void setMaxBackOffPeriod(long backOffPeriod)
backOffPeriod - the back off periodpublic long getMaxBackOffPeriod()
protected void doBackOff()
throws BackOffInterruptedException
setMinBackOffPeriod(long).doBackOff in class StatelessBackOffPolicyBackOffInterruptedException - if interrupted during sleep.Copyright © 2018 SpringSource. All rights reserved.