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
Constructors Constructor Description ExponentialBackoffBuilderImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ExponentialBackoffBuilderbackoffFactor(double backoffFactor)Sets the backoff multiplication factor.BackoffSupplierbuild()ExponentialBackoffBuilderjitterFactor(double jitterFactor)Sets the jitter factor.ExponentialBackoffBuildermaxDelay(long maxDelay)Sets the maximum retry delay.ExponentialBackoffBuilderminDelay(long minDelay)Sets the minimum retry delay.ExponentialBackoffBuilderrandom(Random random)Sets the random number generator used to add jitter to the next delay.
-
-
-
Method Detail
-
maxDelay
public ExponentialBackoffBuilder maxDelay(long maxDelay)
Description copied from interface:ExponentialBackoffBuilderSets the maximum retry delay.Note that the jitter may push the retry delay over this maximum.
Default is 5000ms.
- Specified by:
maxDelayin interfaceExponentialBackoffBuilder- Parameters:
maxDelay- the maximum delay before retrying in ms- Returns:
- the builder for this exponential backoff
-
minDelay
public ExponentialBackoffBuilder minDelay(long minDelay)
Description copied from interface:ExponentialBackoffBuilderSets the minimum retry delay.Note that the jitter may push the retry delay below this minimum.
Default is 50ms.
- Specified by:
minDelayin interfaceExponentialBackoffBuilder- Parameters:
minDelay- the minimum delay before retrying is ms- Returns:
- the builder for this exponential backoff
-
backoffFactor
public ExponentialBackoffBuilder backoffFactor(double backoffFactor)
Description copied from interface:ExponentialBackoffBuilderSets the backoff multiplication factor. The previous delay is multiplied by this factor. Default is 1.6.- Specified by:
backoffFactorin interfaceExponentialBackoffBuilder- Parameters:
backoffFactor- the factor to multiply with the previous delay to determine the next delay- Returns:
- the builder for this exponential backoff
-
jitterFactor
public ExponentialBackoffBuilder jitterFactor(double jitterFactor)
Description copied from interface:ExponentialBackoffBuilderSets 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:
jitterFactorin interfaceExponentialBackoffBuilder- Parameters:
jitterFactor- the range of possible jitter defined as a factor- Returns:
- the builder for this exponential backoff
-
random
public ExponentialBackoffBuilder random(Random random)
Description copied from interface:ExponentialBackoffBuilderSets the random number generator used to add jitter to the next delay.Default is
new java.util.Random().- Specified by:
randomin interfaceExponentialBackoffBuilder- Parameters:
random- the random to use for jitter- Returns:
- the builder for this exponential backoff
-
build
public BackoffSupplier build()
- Specified by:
buildin interfaceExponentialBackoffBuilder- Returns:
- a new
BackoffSupplierwith the provided configuration options.
-
-