Class RetryPolicy
java.lang.Object
org.hansken.plugin.extraction.runtime.grpc.client.RetryPolicy
A configurable exponential backoff policy which can be used by an
ExtractionPluginClient
for trying to connect when requesting the plugin information or processing a Trace,
instead of failing directly due to unavailability.
The retry algorithm will at each iteration wait between 0 and the current iteration backoff
time. The backoff starts with the initialBackoffMs(Duration), and is multiplied
each iteration using backOffMultiplier(double), up to maxBackOff(Duration).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbackOffMultiplier(double backOffMultiplier) The factor to multiply the maximum backoff value with on each iteration.initialBackoffMs(Duration initialBackoff) The initial wait time bound of the first retry iteration.maxAttempts(int maxAttempts) Set the maximum total attempts trying to connect.maxBackOff(Duration maxBackOff) The maximum wait time bound for any iteration.static RetryPolicyGet a default policy, which has the following parameters:maxAttempts=10, initialBackoff=250ms, maxBackOff=10s, backOffMultiplier=2.
-
Constructor Details
-
RetryPolicy
public RetryPolicy()
-
-
Method Details
-
withDefaultSettings
Get a default policy, which has the following parameters:maxAttempts=10, initialBackoff=250ms, maxBackOff=10s, backOffMultiplier=2.- Returns:
- a retry policy with default settings
-
maxAttempts
Set the maximum total attempts trying to connect. The value should be at least 2.- Parameters:
maxAttempts- the maximum number of attempts- Returns:
this
-
initialBackoffMs
The initial wait time bound of the first retry iteration. Must be less than or equal to themaximum backoff.- Parameters:
initialBackoff- the initial backoff value- Returns:
this
-
maxBackOff
The maximum wait time bound for any iteration. Must be greater than or equal to theinitial backoff.- Parameters:
maxBackOff- the maximum backoff value- Returns:
this
-
backOffMultiplier
The factor to multiply the maximum backoff value with on each iteration. Should be greater than or equal to 1.- Parameters:
backOffMultiplier- the backoff scale factor- Returns:
this
-