Interface StorageRetryStrategy (2.8.1)

public interface StorageRetryStrategy extends Serializable

A factory class which is used to provide access to ResultRetryAlgorithm for idempotent and non-idempotent calls made via Storage. Before Storage performs an operation it will determine if the operation is idempotent and select the appropriate ResultRetryAlgorithm to use for that invocation. See Also: #getDefaultStorageRetryStrategy(), #getUniformStorageRetryStrategy()

Implements

Serializable

Static Methods

getDefaultStorageRetryStrategy()

public static StorageRetryStrategy getDefaultStorageRetryStrategy()

Factory method to get an instance of the default implementation of StorageRetryStrategy. The returned instance is provides handler which are appropriate for calls which are known to be idempotent vs non-idempotent.

All non-idempotent calls will not be retried

The set of retryable cases handled by this strategy is more comprehensive than that of the legacy strategy and should always be preferred.

The following HTTP Status Codes will be retried for all idempotent calls:

Code Name
408 Request Timeout
429 Too Many Requests
500 Internal Server Error
502 Bad Gateway
503 Service Unavailable
504 Gateway Timeout
See Also: StorageOptions.Builder#setStorageRetryStrategy(StorageRetryStrategy), #getUniformStorageRetryStrategy()

Returns
Type Description
StorageRetryStrategy

getLegacyStorageRetryStrategy() (deprecated)

public static StorageRetryStrategy getLegacyStorageRetryStrategy()

Deprecated. please migrate to using #getDefaultStorageRetryStrategy() which is capable of providing handlers which are appropriate for idempotent and non-idempotent calls.

Factory method to get an instance of StorageRetryStrategy with the behavior which was used prior to version 2.1.8. This strategy is unsafe and will result in retying some non-idempotent calls. See Also: StorageOptions.Builder#setStorageRetryStrategy(StorageRetryStrategy), #getDefaultStorageRetryStrategy()

Returns
Type Description
StorageRetryStrategy

getUniformStorageRetryStrategy()

public static StorageRetryStrategy getUniformStorageRetryStrategy()

Factory method to get an instance of StorageRetryStrategy which will uniformly retry all calls as if they were idempotent.

NOTE:This strategy is unsafe and will result in retying some non-idempotent calls. Care should be taken to ensure calls which would not normally be considered idempotent are made idempotent by some other means in your program. See Also: StorageOptions.Builder#setStorageRetryStrategy(StorageRetryStrategy), #getDefaultStorageRetryStrategy()

Returns
Type Description
StorageRetryStrategy

Methods

getIdempotentHandler()

public abstract ResultRetryAlgorithm<?> getIdempotentHandler()

Factory method to provide a ResultRetryAlgorithm which will be used to evaluate whether a retry can happen for an operation which has been deemed idempotent.

Returns
Type Description
ResultRetryAlgorithm<?>

getNonidempotentHandler()

public abstract ResultRetryAlgorithm<?> getNonidempotentHandler()
Returns
Type Description
ResultRetryAlgorithm<?>