File tree
Expand file treeCollapse file tree1 file changed
+6
-7
lines changed samples/snippets/src/main/java/com/example/storage
Expand file treeCollapse file tree1 file changed
+6
-7
lines changed Original file line number | Diff line number | Diff line change |
---|
@@ -32,28 +32,27 @@ public static void main(String[] args) {
|
32 | 32 | }
|
33 | 33 |
|
34 | 34 | static void deleteBlob(String bucketName, String blobName) {
|
35 |
| -// Update the retry settings |
| 35 | +// Customize retry behavior |
36 | 36 | RetrySettings retrySettings =
|
37 | 37 | StorageOptions.getDefaultRetrySettings()
|
38 | 38 | .toBuilder()
|
39 |
| -// to set the max number of attempts to 10 |
| 39 | +// Set the max number of attempts to 10 (initial attempt plus 9 retries) |
40 | 40 | .setMaxAttempts(10)
|
41 |
| -// to set the backoff multiplier to 3.0 |
| 41 | +// Set the backoff multiplier to 3.0 |
42 | 42 | .setRetryDelayMultiplier(3.0)
|
43 |
| -// to set the max duration of all attempts to 5 minutes |
| 43 | +// Set the max duration of all attempts to 5 minutes |
44 | 44 | .setTotalTimeout(Duration.ofMinutes(5))
|
45 | 45 | .build();
|
46 | 46 |
|
47 | 47 | StorageOptions alwaysRetryStorageOptions =
|
48 | 48 | StorageOptions.newBuilder()
|
49 |
| -// Configure our options so all requests will be retried even if they are |
50 |
| -// non-idempotent. |
| 49 | +// Customize retry so all requests are retried even if they are non-idempotent. |
51 | 50 | .setStorageRetryStrategy(StorageRetryStrategy.getUniformStorageRetryStrategy())
|
52 | 51 | // provide the previously configured retrySettings
|
53 | 52 | .setRetrySettings(retrySettings)
|
54 | 53 | .build();
|
55 | 54 |
|
56 |
| -// Instantiate a client with our options |
| 55 | +// Instantiate a client |
57 | 56 | Storage storage = alwaysRetryStorageOptions.getService();
|
58 | 57 |
|
59 | 58 | // Delete the blob
|
|
You can’t perform that action at this time.
0 commit comments