Package org.camunda.bpm.client.backoff
Interface ErrorAwareBackoffStrategy
-
- All Superinterfaces:
BackoffStrategy
- All Known Implementing Classes:
ExponentialErrorBackoffStrategy
public interface ErrorAwareBackoffStrategy extends BackoffStrategy
Provides a way to define a back off between fetch and lock requests.
Note: Since an implementation of this interface may be executed by multiple threads, it is recommended to implement the custom backoff strategy in a thread-safe manner.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description long
calculateBackoffTime()
Calculates the back off time and is invoked afterreconfigure(List, ExternalTaskClientException)
.default void
reconfigure(List<ExternalTask> externalTasks)
This is to provide compatibility with existing BackoffStrategy configurations.void
reconfigure(List<ExternalTask> externalTasks, ExternalTaskClientException exception)
Reconfigures the back off strategy based on the fetched external tasks and any error that might have occurred.
-
-
-
Method Detail
-
reconfigure
default void reconfigure(List<ExternalTask> externalTasks)
This is to provide compatibility with existing BackoffStrategy configurations. Do not override. Implementations of ErrorAwareBackoffStrategy should overridereconfigure(List, ExternalTaskClientException)
instead.- Specified by:
reconfigure
in interfaceBackoffStrategy
- Parameters:
externalTasks
- which have been fetched
-
reconfigure
void reconfigure(List<ExternalTask> externalTasks, ExternalTaskClientException exception)
Reconfigures the back off strategy based on the fetched external tasks and any error that might have occurred. It is invoked before
calculateBackoffTime()
.The implementation might count the amount of invocations and realize a strategy reset.
- Parameters:
externalTasks
- which have been fetchedexception
- can be of the following types:EngineException
if something went wrong during the engine execution (e.g., a persistence exception occurred).BadRequestException
if an illegal operation was performed or the given data is invalid.ConnectionLostException
if the connection could not be established.UnknownHttpErrorException
if the HTTP status code is not known by the client.
-
calculateBackoffTime
long calculateBackoffTime()
Calculates the back off time and is invoked after
reconfigure(List, ExternalTaskClientException)
.- Specified by:
calculateBackoffTime
in interfaceBackoffStrategy
- Returns:
- the back off time between fetch and lock requests in milliseconds
-
-