public abstract static class RetrySettings.Builder
A base builder class for RetrySettings. See the class documentation of RetrySettings for a description of the different values that can be set.
Constructors
Builder()
Methods
build()
public RetrySettings build()
getInitialRetryDelay()
public abstract Duration getInitialRetryDelay()
InitialRetryDelay controls the delay before the first retry. Subsequent retries will use this
value adjusted according to the RetryDelayMultiplier. The default value is
Duration.ZERO
.
Returns |
---|
Type | Description |
org.threeten.bp.Duration | |
getInitialRpcTimeout()
public abstract Duration getInitialRpcTimeout()
InitialRpcTimeout controls the timeout for the initial RPC. Subsequent calls will use this
value adjusted according to the RpcTimeoutMultiplier. The default value is
Duration.ZERO
.
Returns |
---|
Type | Description |
org.threeten.bp.Duration | |
getMaxAttempts()
public abstract int getMaxAttempts()
MaxAttempts defines the maximum number of attempts to perform. The default value is
0
. If this value is greater than 0, and the number of attempts reaches this limit, the logic
will give up retrying even if the total retry time is still lower than TotalTimeout.
Returns |
---|
Type | Description |
int | |
getMaxRetryDelay()
public abstract Duration getMaxRetryDelay()
MaxRetryDelay puts a limit on the value of the retry delay, so that the RetryDelayMultiplier
can't increase the retry delay higher than this amount. The default value is
Duration.ZERO
.
Returns |
---|
Type | Description |
org.threeten.bp.Duration | |
getMaxRpcTimeout()
public abstract Duration getMaxRpcTimeout()
MaxRpcTimeout puts a limit on the value of the RPC timeout, so that the RpcTimeoutMultiplier
can't increase the RPC timeout higher than this amount.
Returns |
---|
Type | Description |
org.threeten.bp.Duration | |
getRetryDelayMultiplier()
public abstract double getRetryDelayMultiplier()
RetryDelayMultiplier controls the change in retry delay. The retry delay of the previous call
is multiplied by the RetryDelayMultiplier to calculate the retry delay for the next call. The
default value is 1.0
.
getRpcTimeoutMultiplier()
public abstract double getRpcTimeoutMultiplier()
See the class documentation of RetrySettings for a description of what this value
does. The default value is 1.0
.
getTotalTimeout()
public abstract Duration getTotalTimeout()
TotalTimeout has ultimate control over how long the logic should keep trying the remote call
until it gives up completely. The higher the total timeout, the more retries can be
attempted. The default value is Duration.ZERO
.
Returns |
---|
Type | Description |
org.threeten.bp.Duration | |
isJittered()
public abstract boolean isJittered()
Jitter determines if the delay time should be randomized. In most cases, if jitter is set to
true
the actual delay time is calculated in the following way:
actualDelay = rand_between(0, min(maxRetryDelay, exponentialDelay))
The default value is true
.
merge(RetrySettings.Builder newSettings)
public RetrySettings.Builder merge(RetrySettings.Builder newSettings)
setInitialRetryDelay(Duration initialDelay)
public abstract RetrySettings.Builder setInitialRetryDelay(Duration initialDelay)
InitialRetryDelay controls the delay before the first retry. Subsequent retries will use this
value adjusted according to the RetryDelayMultiplier. The default value is
Duration.ZERO
.
Parameter |
---|
Name | Description |
initialDelay | org.threeten.bp.Duration
|
setInitialRpcTimeout(Duration initialTimeout)
public abstract RetrySettings.Builder setInitialRpcTimeout(Duration initialTimeout)
InitialRpcTimeout controls the timeout for the initial RPC. Subsequent calls will use this
value adjusted according to the RpcTimeoutMultiplier. The default value is
Duration.ZERO
.
Parameter |
---|
Name | Description |
initialTimeout | org.threeten.bp.Duration
|
setJittered(boolean jittered) (deprecated)
public abstract RetrySettings.Builder setJittered(boolean jittered)
Deprecated. Retries always jitter.
Jitter determines if the delay time should be randomized. If jitter is set to true
the actual delay time is calculated in the following way:
actualDelay = rand_between(0, min(maxRetryDelay, exponentialDelay))
The default value is true
, and this method will be a no-op soon.
Parameter |
---|
Name | Description |
jittered | boolean
|
setLogicalTimeout(Duration timeout)
public RetrySettings.Builder setLogicalTimeout(Duration timeout)
Configures the timeout settings with the given timeout such that the logical call will take
no longer than the given timeout and each RPC attempt will use only the time remaining in the
logical call as a timeout.
Using this method in conjunction with individual RetrySettings timeout field
setters is not advised, because only the order in which they are invoked determines which
setter is respected.
Parameter |
---|
Name | Description |
timeout | org.threeten.bp.Duration
|
setMaxAttempts(int maxAttempts)
public abstract RetrySettings.Builder setMaxAttempts(int maxAttempts)
MaxAttempts defines the maximum number of attempts to perform. The default value is
0
. If this value is greater than 0, and the number of attempts reaches this limit, the logic
will give up retrying even if the total retry time is still lower than TotalTimeout.
Parameter |
---|
Name | Description |
maxAttempts | int
|
setMaxRetryDelay(Duration maxDelay)
public abstract RetrySettings.Builder setMaxRetryDelay(Duration maxDelay)
MaxRetryDelay puts a limit on the value of the retry delay, so that the RetryDelayMultiplier
can't increase the retry delay higher than this amount. The default value is
Duration.ZERO
.
Parameter |
---|
Name | Description |
maxDelay | org.threeten.bp.Duration
|
setMaxRpcTimeout(Duration maxTimeout)
public abstract RetrySettings.Builder setMaxRpcTimeout(Duration maxTimeout)
MaxRpcTimeout puts a limit on the value of the RPC timeout, so that the RpcTimeoutMultiplier
can't increase the RPC timeout higher than this amount. The default value is
Duration.ZERO
.
Parameter |
---|
Name | Description |
maxTimeout | org.threeten.bp.Duration
|
setRetryDelayMultiplier(double multiplier)
public abstract RetrySettings.Builder setRetryDelayMultiplier(double multiplier)
RetryDelayMultiplier controls the change in retry delay. The retry delay of the previous call
is multiplied by the RetryDelayMultiplier to calculate the retry delay for the next call. The
default value is 1.0
.
Parameter |
---|
Name | Description |
multiplier | double
|
setRpcTimeoutMultiplier(double multiplier)
public abstract RetrySettings.Builder setRpcTimeoutMultiplier(double multiplier)
See the class documentation of RetrySettings for a description of what this value
does. The default value is 1.0
.
Parameter |
---|
Name | Description |
multiplier | double
|
setTotalTimeout(Duration totalTimeout)
public abstract RetrySettings.Builder setTotalTimeout(Duration totalTimeout)
TotalTimeout has ultimate control over how long the logic should keep trying the remote call
until it gives up completely. The higher the total timeout, the more retries can be
attempted. The default value is Duration.ZERO
.
Parameter |
---|
Name | Description |
totalTimeout | org.threeten.bp.Duration
|