@Experimental public interface ExponentialBackOff
This interface contains 2 methods: backoffSleep()
which should be invoked if the request needs to be retried
and reset()
, invoked when a request is "successful", which resets the state.
The interface may me changed in the future to include async methods.
Modifier and Type | Field and Description |
---|---|
static ExponentialBackOff |
NO_OP
Disabled exponential back-off algorithm.
|
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.
|
static final ExponentialBackOff NO_OP
void backoffSleep() throws InterruptedException
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.
InterruptedException
- If the Thread
is interrupted while blocked.void reset()
The blocking time in backoffSleep()
increases with the number of consecutive retries. This methods resets
its state back to the initial sleep time.
Copyright © 2021 JBoss by Red Hat. All rights reserved.