public class CloudStorageRetryHandler extends Object
Constructor and Description |
---|
CloudStorageRetryHandler(CloudStorageConfiguration config)
Create a CloudStorageRetryHandler with the maximum retries and reopens set to the same value.
|
CloudStorageRetryHandler(int maxRetriesAndReopens)
Deprecated.
use CloudStorageRetryHandler(CloudStorageConfiguration) instead.
|
CloudStorageRetryHandler(int maxRetries,
int maxReopens)
Deprecated.
use CloudStorageRetryHandler(CloudStorageConfiguration) instead.
|
CloudStorageRetryHandler(int maxRetries,
int maxReopens,
CloudStorageConfiguration config)
Create a CloudStorageRetryHandler with the maximum retries and reopens set to different values.
|
Modifier and Type | Method and Description |
---|---|
boolean |
handleStorageException(com.google.cloud.storage.StorageException exs)
Checks whether we should retry, reopen, or give up.
|
int |
reopens() |
int |
retries() |
@Deprecated public CloudStorageRetryHandler(int maxRetriesAndReopens)
maxRetriesAndReopens
- value for both maxRetries and maxReopens@Deprecated public CloudStorageRetryHandler(int maxRetries, int maxReopens)
maxRetries
- maximum number of retriesmaxReopens
- maximum number of reopenspublic CloudStorageRetryHandler(CloudStorageConfiguration config)
config
- - configuration for reopens and retryable codes.public CloudStorageRetryHandler(int maxRetries, int maxReopens, CloudStorageConfiguration config)
maxRetries
- maximum number of retriesmaxReopens
- maximum number of reopens (overrides what's in the config)config
- http codes we'll retry on, and exceptions we'll reopen on.public int retries()
public int reopens()
public boolean handleStorageException(com.google.cloud.storage.StorageException exs) throws com.google.cloud.storage.StorageException
In the latter case it throws an exception (this includes the scenario where we exhausted the retry count).
Otherwise, it sleeps for a bit and returns whether we should reopen. The sleep time is dependent on the retry number.
exs
- caught StorageExceptioncom.google.cloud.storage.StorageException
- if the exception is not retryable, or if you ran out of retries.Copyright © 2023 Google LLC. All rights reserved.