Package org.camunda.bpm.client.backoff
Class ExponentialErrorBackoffStrategy
- java.lang.Object
-
- org.camunda.bpm.client.backoff.ExponentialErrorBackoffStrategy
-
- All Implemented Interfaces:
BackoffStrategy
,ErrorAwareBackoffStrategy
public class ExponentialErrorBackoffStrategy extends java.lang.Object implements 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.
-
-
Constructor Summary
Constructors Constructor Description ExponentialErrorBackoffStrategy()
ExponentialErrorBackoffStrategy(long initTime, float factor, long maxTime)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
calculateBackoffTime()
Calculates the back off time and is invoked afterErrorAwareBackoffStrategy.reconfigure(List, Exception)
.void
reconfigure(java.util.List<ExternalTask> externalTasks, java.lang.Exception 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, wait
-
Methods inherited from interface org.camunda.bpm.client.backoff.ErrorAwareBackoffStrategy
reconfigure
-
-
-
-
Constructor Detail
-
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 Detail
-
reconfigure
public void reconfigure(java.util.List<ExternalTask> externalTasks, java.lang.Exception error)
Description copied from interface:ErrorAwareBackoffStrategy
Reconfigures 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:
reconfigure
in interfaceErrorAwareBackoffStrategy
- Parameters:
externalTasks
- which have been fetched
-
calculateBackoffTime
public long calculateBackoffTime()
Description copied from interface:ErrorAwareBackoffStrategy
Calculates the back off time and is invoked after
ErrorAwareBackoffStrategy.reconfigure(List, Exception)
.- Specified by:
calculateBackoffTime
in interfaceBackoffStrategy
- Specified by:
calculateBackoffTime
in interfaceErrorAwareBackoffStrategy
- Returns:
- the back off time between fetch and lock requests in milliseconds
-
-