public class ExponentialBackOffImpl extends Object implements ExponentialBackOff
ExponentialBackOff
implementation for IRAC (asynchronous cross-site replication).
An exponential back-off implementation with min interval of 500 ms and a maximum of 300'000 ms (5 min). It uses a multiplier of 2 (each timeslot will be increase + 100% for each consecutive retry) and the final wait time is randomized, +- 50% of the timeslot.
NO_OP
Constructor and Description |
---|
ExponentialBackOffImpl() |
Modifier and Type | Method and Description |
---|---|
void |
backoffSleep()
It blocks the thread for a certain amount of time before retries the request.
|
void |
reset()
Resets its state.
|
public void backoffSleep() throws InterruptedException
ExponentialBackOff
The method is blocking and should be invoked when a request needs to be retried. It blocks the thread for a certain amount of time until it is allowed to do the request again.
backoffSleep
in interface ExponentialBackOff
InterruptedException
- If the Thread
is interrupted while blocked.public void reset()
ExponentialBackOff
The blocking time in ExponentialBackOff.backoffSleep()
increases with the number of consecutive retries. This methods resets
its state back to the initial sleep time.
reset
in interface ExponentialBackOff
Copyright © 2021 JBoss by Red Hat. All rights reserved.