RequestOptions Class

  • java.lang.Object
    • com.microsoft.azure.storage.RequestOptions

public class RequestOptions

Represents the options to use while processing a given request.

Constructor Summary

Constructor Description
RequestOptions()

Creates an instance of the class.

RequestOptions(final RequestOptions other)

Creates an instance of the class by copying values from another instance.

Method Summary

Modifier and Type Method and Description
void applyBaseDefaultsInternal(final RequestOptions modifiedOptions)

Populates the default timeout, retry policy, and location mode from client if they are null.

Boolean disableHttpsSocketKeepAlive()

Gets a value to indicate whether https socket keep-alive should be disabled. Use to disable keep-alive; otherwise, . For more information about disableHttpsSocketKeepAlive defaults, see getDefaultRequestOptions()

final LocationMode getLocationMode()

Gets the default location mode for this request. For more information about location mode, see setLocationMode(final LocationMode locationMode).

Integer getMaximumExecutionTimeInMs()

Gets the maximum execution time for this request. For more information about maximum execution time defaults, see setMaximumExecutionTimeInMs(Integer maximumExecutionTimeInMs).

Long getOperationExpiryTimeInMs()

RESERVED FOR INTERNAL USE.

Returns the time at which this operation expires. This is computed by adding the time the operation begins and the maximum execution time and will be null if maximum execution time is null. For more information about maximum execution time, see setMaximumExecutionTimeInMs(Integer maximumExecutionTimeInMs).

final RetryPolicyFactory getRetryPolicyFactory()

Gets the retry policy to use for this request. For more information about the retry policy defaults, see setRetryPolicyFactory(final RetryPolicyFactory retryPolicyFactory).

final Integer getTimeoutIntervalInMs()

Returns the timeout value for this request. For more information about the timeout defaults, see setTimeoutIntervalInMs(final Integer timeoutIntervalInMs).

void populateRequestOptions(RequestOptions modifiedOptions, final RequestOptions clientOptions, final boolean setStartTime)

Populates any null fields in the first requestOptions object with values from the second requestOptions object.

Boolean requireEncryption()

Gets a value to indicate whether all data written and read must be encrypted. Use to encrypt/decrypt data for transactions; otherwise, . For more information about require encryption defaults, see setRequireEncryption(Boolean requireEncryption).

void setDisableHttpsSocketKeepAlive(Boolean disableHttpsSocketKeepAlive)

Sets a value to indicate whether https socket keep-alive should be disabled. Use to disable keep-alive; otherwise,

The default is set in the client and is by default true, indicating that https socket keep-alive will be disabled. You can change the value on this request by setting this property. You can also change the value on on the getDefaultRequestOptions() object so that all subsequent requests made via the service client will use the appropriate value.

Setting keep-alive on https sockets is to work around a bug in the JVM where connection timeouts are not honored on retried requests. In those cases, you may choose to use socket keep-alive as a fallback. Unfortunately, the timeout value must be taken from a JVM property rather than configured locally. Therefore, in rare cases the JVM has configured aggressively short keep-alive times, it may not be beneficial to enable the use of keep-alives lest they interfere with long running data transfer operations.

void setLocationMode(final LocationMode locationMode)

Sets the LocationMode for this request.

The default LocationMode is set in the client and is by default PRIMARY_ONLY. You can change the LocationMode on this request by setting this property. You can also change the value on the getDefaultRequestOptions() object so that all subsequent requests made via the service client will use that LocationMode.

void setMaximumExecutionTimeInMs(Integer maximumExecutionTimeInMs)

Sets the maximum execution time to use when making this request.

The maximum execution time interval begins at the time that the client begins building the request. The maximum execution time is checked intermittently while uploading data, downloading data, and before executing retries. The service will continue to upload, download, and retry until the maximum execution time is reached. At that time, any partial uploads or downloads will be cancelled and an exception will be thrown.

The default maximum execution is set in the client and is by default null, indicating no maximum time. You can change the maximum execution time on this request by setting this property. You can also change the value on the getDefaultRequestOptions() object so that all subsequent requests made via the service client will use the maximum execution time.

void setRequireEncryption(Boolean requireEncryption)

Sets a value to indicate whether all data written and read must be encrypted. Use to encrypt/decrypt data for transactions; otherwise, .

The default is set in the client and is by default false, indicating encryption is not required. You can change the value on this request by setting this property. You can also change the value on the getDefaultRequestOptions() object so that all subsequent requests made via the service client will use the appropriate value.

final void setRetryPolicyFactory(final RetryPolicyFactory retryPolicyFactory)

Sets the RetryPolicyFactory object to use for this request.

The default RetryPolicyFactory is set in the client and is by default RetryExponentialRetry. You can change the RetryPolicyFactory on this request by setting this property. You can also change the value on the getDefaultRequestOptions() object so that all subsequent requests made via the service client will use that RetryPolicyFactory.

final void setTimeoutIntervalInMs(final Integer timeoutIntervalInMs)

Sets the timeout to use when making this request.

The server timeout interval begins at the time that the complete request has been received by the service, and the server begins processing the response. If the timeout interval elapses before the response is returned to the client, the operation times out. The timeout interval resets with each retry, if the request is retried.

The default server timeout is set in the client and is by default null, indicating no server timeout. You can change the server timeout on this request by setting this property. You can also change the value on the getDefaultRequestOptions() object so that all subsequent requests made via the service client will use that server timeout.

Constructor Details

RequestOptions

public RequestOptions()

Creates an instance of the class.

RequestOptions

public RequestOptions(final RequestOptions other)

Creates an instance of the class by copying values from another instance.

Parameters:

other - A RequestOptions object that represents the request options to copy.

Method Details

applyBaseDefaultsInternal

protected static void applyBaseDefaultsInternal(final RequestOptions modifiedOptions)

Populates the default timeout, retry policy, and location mode from client if they are null.

Parameters:

modifiedOptions - The input options to copy from when applying defaults

disableHttpsSocketKeepAlive

public Boolean disableHttpsSocketKeepAlive()

Gets a value to indicate whether https socket keep-alive should be disabled. Use to disable keep-alive; otherwise, . For more information about disableHttpsSocketKeepAlive defaults, see getDefaultRequestOptions()

Returns:

A value to indicate whether https socket keep-alive should be disabled.

getLocationMode

public final LocationMode getLocationMode()

Gets the default location mode for this request. For more information about location mode, see setLocationMode(final LocationMode locationMode).

Returns:

A LocationMode object that represents the location mode for this request.

getMaximumExecutionTimeInMs

public Integer getMaximumExecutionTimeInMs()

Gets the maximum execution time for this request. For more information about maximum execution time defaults, see setMaximumExecutionTimeInMs(Integer maximumExecutionTimeInMs).

Returns:

The current maximum execution time, in milliseconds, for this request.

getOperationExpiryTimeInMs

public Long getOperationExpiryTimeInMs()

RESERVED FOR INTERNAL USE.

Returns the time at which this operation expires. This is computed by adding the time the operation begins and the maximum execution time and will be null if maximum execution time is null. For more information about maximum execution time, see setMaximumExecutionTimeInMs(Integer maximumExecutionTimeInMs).

Returns:

The current operation expiry time, in milliseconds, for this request.

getRetryPolicyFactory

public final RetryPolicyFactory getRetryPolicyFactory()

Gets the retry policy to use for this request. For more information about the retry policy defaults, see setRetryPolicyFactory(final RetryPolicyFactory retryPolicyFactory).

Returns:

An RetryPolicyFactory object that represents the current retry policy.

getTimeoutIntervalInMs

public final Integer getTimeoutIntervalInMs()

Returns the timeout value for this request. For more information about the timeout defaults, see setTimeoutIntervalInMs(final Integer timeoutIntervalInMs).

Returns:

The current timeout value, in milliseconds, for this request.

populateRequestOptions

protected static void populateRequestOptions(RequestOptions modifiedOptions, final RequestOptions clientOptions, final boolean setStartTime)

Populates any null fields in the first requestOptions object with values from the second requestOptions object.

Parameters:

modifiedOptions
clientOptions
setStartTime

requireEncryption

public Boolean requireEncryption()

Gets a value to indicate whether all data written and read must be encrypted. Use to encrypt/decrypt data for transactions; otherwise, . For more information about require encryption defaults, see setRequireEncryption(Boolean requireEncryption).

Returns:

A value to indicate whether all data written and read must be encrypted.

setDisableHttpsSocketKeepAlive

public void setDisableHttpsSocketKeepAlive(Boolean disableHttpsSocketKeepAlive)

Sets a value to indicate whether https socket keep-alive should be disabled. Use to disable keep-alive; otherwise,

The default is set in the client and is by default true, indicating that https socket keep-alive will be disabled. You can change the value on this request by setting this property. You can also change the value on on the getDefaultRequestOptions() object so that all subsequent requests made via the service client will use the appropriate value.

Setting keep-alive on https sockets is to work around a bug in the JVM where connection timeouts are not honored on retried requests. In those cases, you may choose to use socket keep-alive as a fallback. Unfortunately, the timeout value must be taken from a JVM property rather than configured locally. Therefore, in rare cases the JVM has configured aggressively short keep-alive times, it may not be beneficial to enable the use of keep-alives lest they interfere with long running data transfer operations.

Parameters:

disableHttpsSocketKeepAlive - A value to indicate whether https socket keep-alive should be disabled.

setLocationMode

public void setLocationMode(final LocationMode locationMode)

Sets the LocationMode for this request.

The default LocationMode is set in the client and is by default PRIMARY_ONLY. You can change the LocationMode on this request by setting this property. You can also change the value on the getDefaultRequestOptions() object so that all subsequent requests made via the service client will use that LocationMode.

Parameters:

locationMode - the locationMode to set

setMaximumExecutionTimeInMs

public void setMaximumExecutionTimeInMs(Integer maximumExecutionTimeInMs)

Sets the maximum execution time to use when making this request.

The maximum execution time interval begins at the time that the client begins building the request. The maximum execution time is checked intermittently while uploading data, downloading data, and before executing retries. The service will continue to upload, download, and retry until the maximum execution time is reached. At that time, any partial uploads or downloads will be cancelled and an exception will be thrown.

The default maximum execution is set in the client and is by default null, indicating no maximum time. You can change the maximum execution time on this request by setting this property. You can also change the value on the getDefaultRequestOptions() object so that all subsequent requests made via the service client will use the maximum execution time.

Parameters:

maximumExecutionTimeInMs - The maximum execution time, in milliseconds, to use for this request.

setRequireEncryption

public void setRequireEncryption(Boolean requireEncryption)

Sets a value to indicate whether all data written and read must be encrypted. Use to encrypt/decrypt data for transactions; otherwise, .

The default is set in the client and is by default false, indicating encryption is not required. You can change the value on this request by setting this property. You can also change the value on the getDefaultRequestOptions() object so that all subsequent requests made via the service client will use the appropriate value.

Parameters:

requireEncryption - A value to indicate whether all data written and read must be encrypted.

setRetryPolicyFactory

public final void setRetryPolicyFactory(final RetryPolicyFactory retryPolicyFactory)

Sets the RetryPolicyFactory object to use for this request.

The default RetryPolicyFactory is set in the client and is by default RetryExponentialRetry. You can change the RetryPolicyFactory on this request by setting this property. You can also change the value on the getDefaultRequestOptions() object so that all subsequent requests made via the service client will use that RetryPolicyFactory.

Parameters:

retryPolicyFactory - the RetryPolicyFactory object to use when making service requests.

setTimeoutIntervalInMs

public final void setTimeoutIntervalInMs(final Integer timeoutIntervalInMs)

Sets the timeout to use when making this request.

The server timeout interval begins at the time that the complete request has been received by the service, and the server begins processing the response. If the timeout interval elapses before the response is returned to the client, the operation times out. The timeout interval resets with each retry, if the request is retried.

The default server timeout is set in the client and is by default null, indicating no server timeout. You can change the server timeout on this request by setting this property. You can also change the value on the getDefaultRequestOptions() object so that all subsequent requests made via the service client will use that server timeout.

Parameters:

timeoutIntervalInMs - The timeout, in milliseconds, to use for this request.

Applies to