Package org.camunda.bpm.client.backoff
Class ExponentialBackoffStrategy
java.lang.Object
org.camunda.bpm.client.backoff.ExponentialBackoffStrategy
- All Implemented Interfaces:
BackoffStrategy
Provides an exponential backoff strategy.
- Author:
- Nikola Koevski
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionlong
Calculates the back off time and is invoked afterBackoffStrategy.reconfigure(List)
.void
reconfigure
(List<ExternalTask> externalTasks) Reconfigures the back off strategy based on the fetched external tasks and is invoked beforeBackoffStrategy.calculateBackoffTime()
.
-
Field Details
-
initTime
protected long initTime -
factor
protected float factor -
level
protected int level -
maxTime
protected long maxTime
-
-
Constructor Details
-
ExponentialBackoffStrategy
public ExponentialBackoffStrategy() -
ExponentialBackoffStrategy
public ExponentialBackoffStrategy(long initTime, float factor, long maxTime) - Parameters:
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 suspended
-
-
Method Details
-
reconfigure
Description copied from interface:BackoffStrategy
Reconfigures 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.
- Specified by:
reconfigure
in interfaceBackoffStrategy
- Parameters:
externalTasks
- which have been fetched
-
calculateBackoffTime
public long calculateBackoffTime()Description copied from interface:BackoffStrategy
Calculates the back off time and is invoked after
BackoffStrategy.reconfigure(List)
.- Specified by:
calculateBackoffTime
in interfaceBackoffStrategy
- Returns:
- the back off time between fetch and lock requests in milliseconds
-