Package com.google.api.gax.retrying
Class RetrySettings.Builder
- java.lang.Object
-
- com.google.api.gax.retrying.RetrySettings.Builder
-
- Enclosing class:
- RetrySettings
public abstract static class RetrySettings.Builder extends Object
A base builder class forRetrySettings. See the class documentation ofRetrySettingsfor a description of the different values that can be set.
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description RetrySettingsbuild()abstract org.threeten.bp.DurationgetInitialRetryDelay()InitialRetryDelay controls the delay before the first retry.abstract org.threeten.bp.DurationgetInitialRpcTimeout()InitialRpcTimeout controls the timeout for the initial RPC.abstract intgetMaxAttempts()MaxAttempts defines the maximum number of attempts to perform.abstract org.threeten.bp.DurationgetMaxRetryDelay()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.abstract org.threeten.bp.DurationgetMaxRpcTimeout()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.abstract doublegetRetryDelayMultiplier()RetryDelayMultiplier controls the change in retry delay.abstract doublegetRpcTimeoutMultiplier()See the class documentation ofRetrySettingsfor a description of what this value does.abstract org.threeten.bp.DurationgetTotalTimeout()TotalTimeout has ultimate control over how long the logic should keep trying the remote call until it gives up completely.abstract booleanisJittered()Jitter determines if the delay time should be randomized.RetrySettings.Buildermerge(RetrySettings.Builder newSettings)abstract RetrySettings.BuildersetInitialRetryDelay(org.threeten.bp.Duration initialDelay)InitialRetryDelay controls the delay before the first retry.abstract RetrySettings.BuildersetInitialRpcTimeout(org.threeten.bp.Duration initialTimeout)InitialRpcTimeout controls the timeout for the initial RPC.abstract RetrySettings.BuildersetJittered(boolean jittered)Deprecated.Retries always jitter.RetrySettings.BuildersetLogicalTimeout(org.threeten.bp.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.abstract RetrySettings.BuildersetMaxAttempts(int maxAttempts)MaxAttempts defines the maximum number of attempts to perform.abstract RetrySettings.BuildersetMaxRetryDelay(org.threeten.bp.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.abstract RetrySettings.BuildersetMaxRpcTimeout(org.threeten.bp.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.abstract RetrySettings.BuildersetRetryDelayMultiplier(double multiplier)RetryDelayMultiplier controls the change in retry delay.abstract RetrySettings.BuildersetRpcTimeoutMultiplier(double multiplier)See the class documentation ofRetrySettingsfor a description of what this value does.abstract RetrySettings.BuildersetTotalTimeout(org.threeten.bp.Duration totalTimeout)TotalTimeout has ultimate control over how long the logic should keep trying the remote call until it gives up completely.
-
-
-
Method Detail
-
setTotalTimeout
public abstract RetrySettings.Builder setTotalTimeout(org.threeten.bp.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 isDuration.ZERO.
-
setInitialRetryDelay
public abstract RetrySettings.Builder setInitialRetryDelay(org.threeten.bp.Duration initialDelay)
InitialRetryDelay controls the delay before the first retry. Subsequent retries will use this value adjusted according to the RetryDelayMultiplier. The default value isDuration.ZERO.
-
setRetryDelayMultiplier
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 is1.0.
-
setMaxRetryDelay
public abstract RetrySettings.Builder setMaxRetryDelay(org.threeten.bp.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 isDuration.ZERO.
-
setMaxAttempts
public abstract RetrySettings.Builder setMaxAttempts(int maxAttempts)
MaxAttempts defines the maximum number of attempts to perform. The default value is0. 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.
-
setJittered
@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 totruethe actual delay time is calculated in the following way:
The default value isactualDelay = rand_between(0, min(maxRetryDelay, exponentialDelay))true, and this method will be a no-op soon.
-
setInitialRpcTimeout
public abstract RetrySettings.Builder setInitialRpcTimeout(org.threeten.bp.Duration initialTimeout)
InitialRpcTimeout controls the timeout for the initial RPC. Subsequent calls will use this value adjusted according to the RpcTimeoutMultiplier. The default value isDuration.ZERO.
-
setRpcTimeoutMultiplier
public abstract RetrySettings.Builder setRpcTimeoutMultiplier(double multiplier)
See the class documentation ofRetrySettingsfor a description of what this value does. The default value is1.0.
-
setMaxRpcTimeout
public abstract RetrySettings.Builder setMaxRpcTimeout(org.threeten.bp.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 isDuration.ZERO.
-
getTotalTimeout
public abstract org.threeten.bp.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 isDuration.ZERO.
-
getInitialRetryDelay
public abstract org.threeten.bp.Duration getInitialRetryDelay()
InitialRetryDelay controls the delay before the first retry. Subsequent retries will use this value adjusted according to the RetryDelayMultiplier. The default value isDuration.ZERO.
-
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 is1.0.
-
getMaxAttempts
public abstract int getMaxAttempts()
MaxAttempts defines the maximum number of attempts to perform. The default value is0. 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.
-
isJittered
public abstract boolean isJittered()
Jitter determines if the delay time should be randomized. In most cases, if jitter is set totruethe actual delay time is calculated in the following way:
The default value isactualDelay = rand_between(0, min(maxRetryDelay, exponentialDelay))true.
-
getMaxRetryDelay
public abstract org.threeten.bp.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 isDuration.ZERO.
-
getInitialRpcTimeout
public abstract org.threeten.bp.Duration getInitialRpcTimeout()
InitialRpcTimeout controls the timeout for the initial RPC. Subsequent calls will use this value adjusted according to the RpcTimeoutMultiplier. The default value isDuration.ZERO.
-
getRpcTimeoutMultiplier
public abstract double getRpcTimeoutMultiplier()
See the class documentation ofRetrySettingsfor a description of what this value does. The default value is1.0.
-
getMaxRpcTimeout
public abstract org.threeten.bp.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.
-
setLogicalTimeout
@BetaApi public RetrySettings.Builder setLogicalTimeout(org.threeten.bp.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
RetrySettingstimeout field setters is not advised, because only the order in which they are invoked determines which setter is respected.
-
build
public RetrySettings build()
-
merge
public RetrySettings.Builder merge(RetrySettings.Builder newSettings)
-
-