public class ExponentialBackoffStrategy extends Object implements BackoffStrategy
Provides an exponential backoff strategy.
| Modifier and Type | Field and Description |
|---|---|
protected float |
factor |
protected long |
initTime |
protected int |
level |
protected long |
maxTime |
| Constructor and Description |
|---|
ExponentialBackoffStrategy() |
ExponentialBackoffStrategy(long initTime,
float factor,
long maxTime) |
| Modifier and Type | Method and Description |
|---|---|
long |
calculateBackoffTime()
Calculates the back off time and is invoked after
BackoffStrategy.reconfigure(List). |
void |
reconfigure(List<ExternalTask> externalTasks)
Reconfigures the back off strategy based on the fetched external tasks and is invoked
before
BackoffStrategy.calculateBackoffTime(). |
protected long initTime
protected float factor
protected int level
protected long maxTime
public ExponentialBackoffStrategy()
public ExponentialBackoffStrategy(long initTime,
float factor,
long maxTime)
initTime - in milliseconds for which the client is suspended after the first requestfactor - is the base of the power by which the waiting time increasesmaxTime - in milliseconds for which the client can be suspendedpublic void reconfigure(List<ExternalTask> externalTasks)
BackoffStrategyReconfigures the back off strategy based on the fetched external tasks and is invoked
before BackoffStrategy.calculateBackoffTime().
The implementation might count the amount of invocations and realize a strategy reset.
reconfigure in interface BackoffStrategyexternalTasks - which have been fetchedpublic long calculateBackoffTime()
BackoffStrategyCalculates the back off time and is invoked after BackoffStrategy.reconfigure(List).
calculateBackoffTime in interface BackoffStrategyCopyright © 2022. All rights reserved.