public class FixedBackOffPolicy extends StatelessBackOffPolicy implements SleepingBackOffPolicy<FixedBackOffPolicy>
BackOffPolicy that pauses for a fixed period of time before
continuing. A pause is implemented using Sleeper.sleep(long).
setBackOffPeriod(long) is thread-safe and it is safe to call
setBackOffPeriod(long) during execution from multiple threads, however this may
cause a single retry operation to have pauses of different intervals.| Constructor and Description |
|---|
FixedBackOffPolicy() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
doBackOff()
Pause for the
setBackOffPeriod(long). |
long |
getBackOffPeriod()
The backoff period in milliseconds.
|
void |
setBackOffPeriod(long backOffPeriod)
Set the back off period in milliseconds.
|
void |
setSleeper(Sleeper sleeper)
Public setter for the
Sleeper strategy. |
String |
toString() |
FixedBackOffPolicy |
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 FixedBackOffPolicy withSleeper(Sleeper sleeper)
SleepingBackOffPolicywithSleeper in interface SleepingBackOffPolicy<FixedBackOffPolicy>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 setBackOffPeriod(long backOffPeriod)
backOffPeriod - the back off periodpublic long getBackOffPeriod()
protected void doBackOff()
throws BackOffInterruptedException
setBackOffPeriod(long).doBackOff in class StatelessBackOffPolicyBackOffInterruptedException - if interrupted during sleep.Copyright © 2018 SpringSource. All rights reserved.