Class ExponentialBackoffBuilderImpl
java.lang.Object
io.camunda.zeebe.client.impl.worker.ExponentialBackoffBuilderImpl
- All Implemented Interfaces:
ExponentialBackoffBuilder
public final class ExponentialBackoffBuilderImpl
extends Object
implements ExponentialBackoffBuilder
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbackoffFactor
(double backoffFactor) Sets the backoff multiplication factor.build()
jitterFactor
(double jitterFactor) Sets the jitter factor.maxDelay
(long maxDelay) Sets the maximum retry delay.minDelay
(long minDelay) Sets the minimum retry delay.Sets the random number generator used to add jitter to the next delay.
-
Constructor Details
-
ExponentialBackoffBuilderImpl
public ExponentialBackoffBuilderImpl()
-
-
Method Details
-
maxDelay
Description copied from interface:ExponentialBackoffBuilder
Sets the maximum retry delay.Note that the jitter may push the retry delay over this maximum.
Default is 5000ms.
- Specified by:
maxDelay
in interfaceExponentialBackoffBuilder
- Parameters:
maxDelay
- the maximum delay before retrying in ms- Returns:
- the builder for this exponential backoff
-
minDelay
Description copied from interface:ExponentialBackoffBuilder
Sets the minimum retry delay.Note that the jitter may push the retry delay below this minimum.
Default is 50ms.
- Specified by:
minDelay
in interfaceExponentialBackoffBuilder
- Parameters:
minDelay
- the minimum delay before retrying is ms- Returns:
- the builder for this exponential backoff
-
backoffFactor
Description copied from interface:ExponentialBackoffBuilder
Sets the backoff multiplication factor. The previous delay is multiplied by this factor. Default is 1.6.- Specified by:
backoffFactor
in interfaceExponentialBackoffBuilder
- Parameters:
backoffFactor
- the factor to multiply with the previous delay to determine the next delay- Returns:
- the builder for this exponential backoff
-
jitterFactor
Description copied from interface:ExponentialBackoffBuilder
Sets the jitter factor. The next delay is changed randomly within a range of +/- this factor.For example, if the next delay is calculated to be 1s and the jitterFactor is 0.1 then the actual next delay can be somewhere between 0.9 and 1.1s.
Default is 0.1
- Specified by:
jitterFactor
in interfaceExponentialBackoffBuilder
- Parameters:
jitterFactor
- the range of possible jitter defined as a factor- Returns:
- the builder for this exponential backoff
-
random
Description copied from interface:ExponentialBackoffBuilder
Sets the random number generator used to add jitter to the next delay.Default is
new java.util.Random()
.- Specified by:
random
in interfaceExponentialBackoffBuilder
- Parameters:
random
- the random to use for jitter- Returns:
- the builder for this exponential backoff
-
build
- Specified by:
build
in interfaceExponentialBackoffBuilder
- Returns:
- a new
BackoffSupplier
with the provided configuration options.
-