Package com.azure.storage.common.policy
Class RequestRetryOptions
java.lang.Object
com.azure.storage.common.policy.RequestRetryOptions
Configuration options for
RequestRetryPolicy.-
Constructor Summary
ConstructorsConstructorDescriptionConfigures how theHttpPipelineshould retry requests.RequestRetryOptions(RetryPolicyType retryPolicyType, Integer maxTries, Integer tryTimeoutInSeconds, Long retryDelayInMs, Long maxRetryDelayInMs, String secondaryHost) Configures how theHttpPipelineshould retry requests.RequestRetryOptions(RetryPolicyType retryPolicyType, Integer maxTries, Duration tryTimeout, Duration retryDelay, Duration maxRetryDelay, String secondaryHost) Configures how theHttpPipelineshould retry requests. -
Method Summary
Modifier and TypeMethodDescriptionstatic RequestRetryOptionsfromRetryOptions(com.azure.core.http.policy.RetryOptions retryOptions, Duration tryTimeout, String secondaryHost) Creates newRequestRetryOptionsfromRetryOptionsand let specify storage specific parameters.Gets the maximum delay allowed between each retry.longDeprecated.intGets the maximum number of retries that will be attempted.Gets the delay between each retry attempt.longDeprecated.Please usegetTryTimeoutDuration()Gets the URI of the secondary host where retries are attempted.intDeprecated.Please usegetTryTimeoutDuration()Gets the maximum time allowed for a request until it is considered timed out.
-
Constructor Details
-
RequestRetryOptions
public RequestRetryOptions()Configures how theHttpPipelineshould retry requests. -
RequestRetryOptions
public RequestRetryOptions(RetryPolicyType retryPolicyType, Integer maxTries, Integer tryTimeoutInSeconds, Long retryDelayInMs, Long maxRetryDelayInMs, String secondaryHost) Configures how theHttpPipelineshould retry requests.- Parameters:
retryPolicyType- Optional. ARetryPolicyTypespecifying the type of retry pattern to use, default value isEXPONENTIAL.maxTries- Optional. Maximum number of attempts an operation will be retried, default is4.tryTimeoutInSeconds- Optional. Specified the maximum time allowed before a request is cancelled and assumed failed, default isInteger.MAX_VALUEs.This value should be based on the bandwidth available to the host machine and proximity to the Storage service, a good starting point may be 60 seconds per MB of anticipated payload size.
retryDelayInMs- Optional. Specifies the amount of delay to use before retrying an operation, default value is4mswhenretryPolicyTypeisEXPONENTIALand30mswhenretryPolicyTypeisFIXED.maxRetryDelayInMs- Optional. Specifies the maximum delay allowed before retrying an operation, default value is120ms.secondaryHost- Optional. Specified a secondary Storage account to retry requests against, default is none.Before setting this understand the issues around reading stale and potentially-inconsistent data, view these Azure Docs for more information.
- Throws:
IllegalArgumentException- IfgetRetryDelayInMsandgetMaxRetryDelayInMsare not both null or non-null orretryPolicyTypeisn'tRetryPolicyType.EXPONENTIALorRetryPolicyType.FIXED.
-
RequestRetryOptions
public RequestRetryOptions(RetryPolicyType retryPolicyType, Integer maxTries, Duration tryTimeout, Duration retryDelay, Duration maxRetryDelay, String secondaryHost) Configures how theHttpPipelineshould retry requests.- Parameters:
retryPolicyType- Optional. ARetryPolicyTypespecifying the type of retry pattern to use, default value isEXPONENTIAL.maxTries- Optional. Maximum number of attempts an operation will be retried, default is4.tryTimeout- Optional. Specified the maximum time allowed before a request is cancelled and assumed failed, default isInteger.MAX_VALUE.This value should be based on the bandwidth available to the host machine and proximity to the Storage service, a good starting point may be 60 seconds per MB of anticipated payload size.
retryDelay- Optional. Specifies the amount of delay to use before retrying an operation, default value is4swhenretryPolicyTypeisEXPONENTIALand30swhenretryPolicyTypeisFIXED.maxRetryDelay- Optional. Specifies the maximum delay allowed before retrying an operation, default value is120s.secondaryHost- Optional. Specified a secondary Storage account to retry requests against, default is none.Before setting this understand the issues around reading stale and potentially-inconsistent data, view these Azure Docs for more information.
- Throws:
IllegalArgumentException- IfgetRetryDelayInMsandgetMaxRetryDelayInMsare not both null or non-null orretryPolicyTypeisn'tRetryPolicyType.EXPONENTIALorRetryPolicyType.FIXED.
-
-
Method Details
-
getMaxTries
public int getMaxTries()Gets the maximum number of retries that will be attempted.- Returns:
- the maximum number of retries that will be attempted.
-
getTryTimeout
Deprecated.Please usegetTryTimeoutDuration()Gets the maximum time, in seconds, allowed for a request until it is considered timed out.- Returns:
- the maximum time, in seconds, allowed for a request until it is considered timed out.
-
getTryTimeoutDuration
Gets the maximum time allowed for a request until it is considered timed out.- Returns:
- the maximum time allowed for a request until it is considered timed out.
-
getSecondaryHost
Gets the URI of the secondary host where retries are attempted. If this is null then there is no secondary host and all retries are attempted against the original host.- Returns:
- the URI of the secondary host where retries are attempted. If this is null then there is no secondary host and all retries are attempted against the original host.
-
getRetryDelayInMs
Deprecated.Please usegetTryTimeoutDuration()Gets the delay in milliseconds between each retry attempt.- Returns:
- the delay in milliseconds between each retry attempt.
-
getRetryDelay
Gets the delay between each retry attempt.- Returns:
- the delay between each retry attempt.
-
getMaxRetryDelayInMs
Deprecated.Please usegetTryTimeoutDuration()Gets the maximum delay in milliseconds allowed between each retry.- Returns:
- the maximum delay in milliseconds allowed between each retry.
-
getMaxRetryDelay
Gets the maximum delay allowed between each retry.- Returns:
- the maximum delay allowed between each retry.
-
fromRetryOptions
public static RequestRetryOptions fromRetryOptions(com.azure.core.http.policy.RetryOptions retryOptions, Duration tryTimeout, String secondaryHost) Creates newRequestRetryOptionsfromRetryOptionsand let specify storage specific parameters.- Parameters:
retryOptions- TheRetryOptions.tryTimeout- Optional. Specified the maximum time allowed before a request is cancelled and assumed failed, default isInteger.MAX_VALUE.secondaryHost- Optional. Specified a secondary Storage account to retry requests against, default is none.- Returns:
- The
RequestRetryOptions - Throws:
IllegalArgumentException- ifretryOptionscan't be mapped toRequestRetryOptions.
-
getTryTimeoutDuration()