|
16 | 16 |
|
17 | 17 | package com.google.cloud;
|
18 | 18 |
|
19 |
| -import static com.google.api.gax.util.TimeConversionUtils.toThreetenDuration; |
20 | 19 | import static com.google.common.base.Preconditions.checkNotNull;
|
21 | 20 |
|
22 | 21 | import com.google.api.core.BetaApi;
|
23 |
| -import com.google.api.core.ObsoleteApi; |
24 | 22 | import com.google.api.gax.retrying.RetrySettings;
|
25 | 23 | import java.io.Serializable;
|
| 24 | +import org.threeten.bp.Duration; |
26 | 25 |
|
27 | 26 | /**
|
28 | 27 | * This class represents an options wrapper around the {@link RetrySettings} class and is an
|
@@ -53,43 +52,25 @@ private RetryOption(OptionType type, Object value) {
|
53 | 52 | }
|
54 | 53 |
|
55 | 54 | /** See {@link RetrySettings#getTotalTimeout()}. */
|
56 |
| - @ObsoleteApi("Use totalTimeout(java.time.Duration) instead") |
57 |
| - public static RetryOption totalTimeout(org.threeten.bp.Duration totalTimeout) { |
| 55 | + public static RetryOption totalTimeout(Duration totalTimeout) { |
58 | 56 | return new RetryOption(OptionType.TOTAL_TIMEOUT, totalTimeout);
|
59 | 57 | }
|
60 | 58 |
|
61 |
| - /** See {@link RetrySettings#getTotalTimeout()}. */ |
62 |
| - public static RetryOption totalTimeout(java.time.Duration totalTimeout) { |
63 |
| - return totalTimeout(toThreetenDuration(totalTimeout)); |
64 |
| - } |
65 |
| - |
66 | 59 | /** See {@link RetrySettings#getInitialRetryDelay()}. */
|
67 |
| - @ObsoleteApi("Use initialRetryDelay(java.time.Duration) instead") |
68 |
| - public static RetryOption initialRetryDelay(org.threeten.bp.Duration initialRetryDelay) { |
| 60 | + public static RetryOption initialRetryDelay(Duration initialRetryDelay) { |
69 | 61 | return new RetryOption(OptionType.INITIAL_RETRY_DELAY, initialRetryDelay);
|
70 | 62 | }
|
71 | 63 |
|
72 |
| - /** See {@link RetrySettings#getInitialRetryDelay()}. */ |
73 |
| - public static RetryOption initialRetryDelay(java.time.Duration initialRetryDelay) { |
74 |
| - return initialRetryDelay(toThreetenDuration(initialRetryDelay)); |
75 |
| - } |
76 |
| - |
77 | 64 | /** See {@link RetrySettings#getRetryDelayMultiplier()}. */
|
78 | 65 | public static RetryOption retryDelayMultiplier(double retryDelayMultiplier) {
|
79 | 66 | return new RetryOption(OptionType.RETRY_DELAY_MULTIPLIER, retryDelayMultiplier);
|
80 | 67 | }
|
81 | 68 |
|
82 | 69 | /** See {@link RetrySettings#getMaxRetryDelay()}. */
|
83 |
| - @ObsoleteApi("Use maxRetryDelay(java.time.Duration) instead") |
84 |
| - public static RetryOption maxRetryDelay(org.threeten.bp.Duration maxRetryDelay) { |
| 70 | + public static RetryOption maxRetryDelay(Duration maxRetryDelay) { |
85 | 71 | return new RetryOption(OptionType.MAX_RETRY_DELAY, maxRetryDelay);
|
86 | 72 | }
|
87 | 73 |
|
88 |
| - /** See {@link RetrySettings#getMaxRetryDelay()}. */ |
89 |
| - public static RetryOption maxRetryDelay(java.time.Duration maxRetryDelay) { |
90 |
| - return maxRetryDelay(toThreetenDuration(maxRetryDelay)); |
91 |
| - } |
92 |
| - |
93 | 74 | /** See {@link RetrySettings#getMaxAttempts()}. */
|
94 | 75 | public static RetryOption maxAttempts(int maxAttempts) {
|
95 | 76 | return new RetryOption(OptionType.MAX_ATTEMPTS, maxAttempts);
|
@@ -143,16 +124,16 @@ public static RetrySettings mergeToSettings(RetrySettings settings, RetryOption.
|
143 | 124 | for (RetryOption option : options) {
|
144 | 125 | switch (option.type) {
|
145 | 126 | case TOTAL_TIMEOUT:
|
146 |
| - builder.setTotalTimeout((org.threeten.bp.Duration) option.value); |
| 127 | + builder.setTotalTimeout((Duration) option.value); |
147 | 128 | break;
|
148 | 129 | case INITIAL_RETRY_DELAY:
|
149 |
| - builder.setInitialRetryDelay((org.threeten.bp.Duration) option.value); |
| 130 | + builder.setInitialRetryDelay((Duration) option.value); |
150 | 131 | break;
|
151 | 132 | case RETRY_DELAY_MULTIPLIER:
|
152 | 133 | builder.setRetryDelayMultiplier((Double) option.value);
|
153 | 134 | break;
|
154 | 135 | case MAX_RETRY_DELAY:
|
155 |
| - builder.setMaxRetryDelay((org.threeten.bp.Duration) option.value); |
| 136 | + builder.setMaxRetryDelay((Duration) option.value); |
156 | 137 | break;
|
157 | 138 | case MAX_ATTEMPTS:
|
158 | 139 | builder.setMaxAttempts((Integer) option.value);
|
|
0 commit comments