Package org.camunda.bpm.client.backoff
Class ExponentialErrorBackoffStrategy
java.lang.Object
org.camunda.bpm.client.backoff.ExponentialErrorBackoffStrategy
- All Implemented Interfaces:
BackoffStrategy,ErrorAwareBackoffStrategy
Provides an exponential backoff strategy when an error occurs fetching external tasks.
Note this strategy does not provide any backoff when no external tasks are received. It should therefore only be used with long polling (asyncResponseTimeout) to ensure appropriate throttling of requests.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongCalculates the back off time and is invoked afterErrorAwareBackoffStrategy.reconfigure(List, ExternalTaskClientException).voidreconfigure(List<ExternalTask> externalTasks, ExternalTaskClientException error) Reconfigures the back off strategy based on the fetched external tasks and any error that might have occurred.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.camunda.bpm.client.backoff.ErrorAwareBackoffStrategy
reconfigure
-
Field Details
-
initTime
protected long initTime -
factor
protected float factor -
level
protected int level -
maxTime
protected long maxTime
-
-
Constructor Details
-
ExponentialErrorBackoffStrategy
public ExponentialErrorBackoffStrategy() -
ExponentialErrorBackoffStrategy
public ExponentialErrorBackoffStrategy(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:ErrorAwareBackoffStrategyReconfigures the back off strategy based on the fetched external tasks and any error that might have occurred. It is invoked before
ErrorAwareBackoffStrategy.calculateBackoffTime().The implementation might count the amount of invocations and realize a strategy reset.
- Specified by:
reconfigurein interfaceErrorAwareBackoffStrategy- Parameters:
externalTasks- which have been fetchederror- can be of the following types:EngineExceptionif something went wrong during the engine execution (e.g., a persistence exception occurred).BadRequestExceptionif an illegal operation was performed or the given data is invalid.ConnectionLostExceptionif the connection could not be established.UnknownHttpErrorExceptionif the HTTP status code is not known by the client.
-
calculateBackoffTime
public long calculateBackoffTime()Description copied from interface:ErrorAwareBackoffStrategyCalculates the back off time and is invoked after
ErrorAwareBackoffStrategy.reconfigure(List, ExternalTaskClientException).- Specified by:
calculateBackoffTimein interfaceBackoffStrategy- Specified by:
calculateBackoffTimein interfaceErrorAwareBackoffStrategy- Returns:
- the back off time between fetch and lock requests in milliseconds
-