Interface StorageRetryStrategy (2.36.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.

Retried HTTP status codes for idempotent calls
CodeName
408Request Timeout
429Too Many Requests
500Internal Server Error
502Bad Gateway
503Service Unavailable
504Gateway Timeout
See Also: StorageOptions.Builder#setStorageRetryStrategy(StorageRetryStrategy), #getUniformStorageRetryStrategy()

Returns
TypeDescription
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
TypeDescription
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
TypeDescription
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
TypeDescription
ResultRetryAlgorithm<?>

getNonidempotentHandler()

public abstract ResultRetryAlgorithm<?> getNonidempotentHandler()
Returns
TypeDescription
ResultRetryAlgorithm<?>