66
66
* <p>Server streaming RPCs interpret RPC timeouts a bit differently. For server streaming RPCs, the
67
67
* RPC timeout gets converted into a wait timeout {@link
68
68
* com.google.api.gax.rpc.ApiCallContext#withStreamWaitTimeout(Duration)}.
69
+ *
70
+ * <p>In Cloud Client Libraries, Retry and LRO Retry Settings may be configured for each RPC in a
71
+ * service. These values are chosen by the service teams and may be found by looking at the
72
+ * {Service}StubSettings.java file in each library. The default values listed below for each
73
+ * configuration are the default values for the RetrySettings class if there are no RPC specific
74
+ * configurations from the Service Team.
69
75
*/
70
76
@ AutoValue
71
77
public abstract class RetrySettings implements Serializable {
@@ -74,36 +80,61 @@ public abstract class RetrySettings implements Serializable {
74
80
75
81
/**
76
82
* TotalTimeout has ultimate control over how long the logic should keep trying the remote call
77
- * until it gives up completely. The higher the total timeout, the more retries can be attempted.
78
- * The default value is {@code Duration.ZERO}.
83
+ * until it gives up completely. The higher the total timeout, the more retries and polls can be
84
+ * attempted. If this value is {@code Duration.ZERO}, then the logic will instead use the number
85
+ * of attempts to determine retries. In the event that both maxAttempts and totalTimeout values
86
+ * are both 0, the logic will not retry. If this value is non-{@code Duration.ZERO}, and the retry
87
+ * duration has reaches the timeout value, the logic will give up retrying even the number of
88
+ * attempts is lower than the maxAttempts value.
89
+ *
90
+ * <p>If there are no configurations, Retries have the default timeout value of {@code
91
+ * Duration.ZERO} and LROs have a default total timeout value of {@code Duration.ofMillis(300000)}
92
+ * (5 minutes).
79
93
*/
80
94
public abstract Duration getTotalTimeout ();
81
95
82
96
/**
83
- * InitialRetryDelay controls the delay before the first retry. Subsequent retries will use this
84
- * value adjusted according to the RetryDelayMultiplier. The default value is {@code
85
- * Duration.ZERO}.
97
+ * InitialRetryDelay controls the delay before the first retry/ poll. Subsequent retries and polls
98
+ * will use this value adjusted according to the RetryDelayMultiplier.
99
+ *
100
+ * <p>If there are no configurations, Retries have the default initial retry delay value of {@code
101
+ * Duration.ZERO} and LROs have a default initial poll delay value of {@code
102
+ * Duration.ofMillis(5000)} (5 seconds).
86
103
*/
87
104
public abstract Duration getInitialRetryDelay ();
88
105
89
106
/**
90
- * RetryDelayMultiplier controls the change in retry delay. The retry delay of the previous call
91
- * is multiplied by the RetryDelayMultiplier to calculate the retry delay for the next call. The
92
- * default value is {@code 1.0}.
107
+ * RetryDelayMultiplier controls the change in delay before the next retry or poll. The retry
108
+ * delay of the previous call is multiplied by the RetryDelayMultiplier to calculate the retry
109
+ * delay for the next call.
110
+ *
111
+ * <p>If there are no configurations, Retries have the default retry delay multiplier value of
112
+ * {@code 1.0} and LROs have a default retry delay multiplier of {@code 1.5}.
93
113
*/
94
114
public abstract double getRetryDelayMultiplier ();
95
115
96
116
/**
97
117
* MaxRetryDelay puts a limit on the value of the retry delay, so that the RetryDelayMultiplier
98
- * can't increase the retry delay higher than this amount. The default value is {@code
99
- * Duration.ZERO}.
118
+ * can't increase the retry delay higher than this amount.
119
+ *
120
+ * <p>If there are no configurations, Retries have the default max retry delay value of {@code
121
+ * Duration.ZERO} and LROs have a default max poll retry delay value of {@code
122
+ * Duration.ofMillis(45000)} (45 seconds).
100
123
*/
101
124
public abstract Duration getMaxRetryDelay ();
102
125
103
126
/**
104
- * MaxAttempts defines the maximum number of attempts to perform. The default value is {@code 0}.
105
- * If this value is greater than 0, and the number of attempts reaches this limit, the logic will
106
- * give up retrying even if the total retry time is still lower than TotalTimeout.
127
+ * MaxAttempts defines the maximum number of retry attempts to perform. If this value is set to 0,
128
+ * the logic will instead use the totalTimeout value to determine retries. In the event that both
129
+ * the maxAttempts and totalTimeout values are both 0, the logic will not retry. If this value is
130
+ * greater than 0, and the number of attempts exceeds this limit, the logic will give up retrying
131
+ * even if the total retry time is still lower than totalTimeout.
132
+ *
133
+ * <p>If there are no configurations, Retries and LROs have the default max attempt value of
134
+ * {@code 0}. LRO polling does not use this value by default.
135
+ *
136
+ * <p>The first RPC invocation will be considered attempt #0. Subsequent calls (retries) will
137
+ * increment the number of attempts and the number of attempts will not exceed this value.
107
138
*/
108
139
public abstract int getMaxAttempts ();
109
140
@@ -123,22 +154,30 @@ public abstract class RetrySettings implements Serializable {
123
154
124
155
/**
125
156
* InitialRpcTimeout controls the timeout for the initial RPC. Subsequent calls will use this
126
- * value adjusted according to the RpcTimeoutMultiplier. The default value is {@code
127
- * Duration.ZERO}.
157
+ * value adjusted according to the RpcTimeoutMultiplier. RPC Timeout value of {@code
158
+ * Duration.ZERO} allows the RPC to continue indefinitely (until it hits a Connect Timeout or the
159
+ * connection has been terminated).
160
+ *
161
+ * <p>If there are no configurations, Retries have the default initial RPC timeout value of {@code
162
+ * Duration.ZERO}. LRO polling does not use the Initial RPC Timeout value.
128
163
*/
129
164
public abstract Duration getInitialRpcTimeout ();
130
165
131
166
/**
132
167
* RpcTimeoutMultiplier controls the change in RPC timeout. The timeout of the previous call is
133
- * multiplied by the RpcTimeoutMultiplier to calculate the timeout for the next call. The default
134
- * value is {@code 1.0}.
168
+ * multiplied by the RpcTimeoutMultiplier to calculate the timeout for the next call.
169
+ *
170
+ * <p>If there are no configurations, Retries have the default RPC Timeout Multiplier value of
171
+ * {@code 1.0}. LRO polling does not use the RPC Timeout Multiplier value.
135
172
*/
136
173
public abstract double getRpcTimeoutMultiplier ();
137
174
138
175
/**
139
176
* MaxRpcTimeout puts a limit on the value of the RPC timeout, so that the RpcTimeoutMultiplier
140
- * can't increase the RPC timeout higher than this amount. The default value is {@code
141
- * Duration.ZERO}.
177
+ * can't increase the RPC timeout higher than this amount.
178
+ *
179
+ * <p>If there are no configurations, Retries have the default Max RPC Timeout value of {@code
180
+ * Duration.ZERO}. LRO polling does not use the Max RPC Timeout value.
142
181
*/
143
182
public abstract Duration getMaxRpcTimeout ();
144
183
@@ -166,36 +205,61 @@ public abstract static class Builder {
166
205
167
206
/**
168
207
* TotalTimeout has ultimate control over how long the logic should keep trying the remote call
169
- * until it gives up completely. The higher the total timeout, the more retries can be
170
- * attempted. The default value is {@code Duration.ZERO}.
208
+ * until it gives up completely. The higher the total timeout, the more retries and polls can be
209
+ * attempted. If this value is {@code Duration.ZERO}, then the logic will instead use the number
210
+ * of attempts to determine retries. In the event that both maxAttempts and totalTimeout values
211
+ * are both 0, the logic will not retry. If this value is non-{@code Duration.ZERO}, and the
212
+ * retry duration has reaches the timeout value, the logic will give up retrying even the number
213
+ * of attempts is lower than the maxAttempts value.
214
+ *
215
+ * <p>If there are no configurations, Retries have the default timeout value of {@code
216
+ * Duration.ZERO} and LROs have a default total timeout value of {@code
217
+ * Duration.ofMillis(300000)} (5 minutes).
171
218
*/
172
219
public abstract Builder setTotalTimeout (Duration totalTimeout );
173
220
174
221
/**
175
- * InitialRetryDelay controls the delay before the first retry. Subsequent retries will use this
176
- * value adjusted according to the RetryDelayMultiplier. The default value is {@code
177
- * Duration.ZERO}.
222
+ * InitialRetryDelay controls the delay before the first retry/ poll. Subsequent retries and
223
+ * polls will use this value adjusted according to the RetryDelayMultiplier.
224
+ *
225
+ * <p>If there are no configurations, Retries have the default initial retry delay value of
226
+ * {@code Duration.ZERO} and LROs have a default initial poll delay value of {@code
227
+ * Duration.ofMillis(5000)} (5 seconds).
178
228
*/
179
229
public abstract Builder setInitialRetryDelay (Duration initialDelay );
180
230
181
231
/**
182
- * RetryDelayMultiplier controls the change in retry delay. The retry delay of the previous call
183
- * is multiplied by the RetryDelayMultiplier to calculate the retry delay for the next call. The
184
- * default value is {@code 1.0}.
232
+ * RetryDelayMultiplier controls the change in delay before the next retry or poll. The retry
233
+ * delay of the previous call is multiplied by the RetryDelayMultiplier to calculate the retry
234
+ * delay for the next call.
235
+ *
236
+ * <p>If there are no configurations, Retries have the default retry delay multiplier value of
237
+ * {@code 1.0} and LROs have a default retry delay multiplier of {@code 1.5}.
185
238
*/
186
239
public abstract Builder setRetryDelayMultiplier (double multiplier );
187
240
188
241
/**
189
242
* MaxRetryDelay puts a limit on the value of the retry delay, so that the RetryDelayMultiplier
190
- * can't increase the retry delay higher than this amount. The default value is {@code
191
- * Duration.ZERO}.
243
+ * can't increase the retry delay higher than this amount.
244
+ *
245
+ * <p>If there are no configurations, Retries have the default max retry delay value of {@code
246
+ * Duration.ZERO} and LROs have a default max poll retry delay value of {@code
247
+ * Duration.ofMillis(45000)} (45 seconds).
192
248
*/
193
249
public abstract Builder setMaxRetryDelay (Duration maxDelay );
194
250
195
251
/**
196
- * MaxAttempts defines the maximum number of attempts to perform. The default value is {@code
197
- * 0}. If this value is greater than 0, and the number of attempts reaches this limit, the logic
198
- * will give up retrying even if the total retry time is still lower than TotalTimeout.
252
+ * MaxAttempts defines the maximum number of retry attempts to perform. If this value is set to
253
+ * 0, the logic will instead use the totalTimeout value to determine retries. In the event that
254
+ * both the maxAttempts and totalTimeout values are both 0, the logic will not retry. If this
255
+ * value is greater than 0, and the number of attempts exceeds this limit, the logic will give
256
+ * up retrying even if the total retry time is still lower than totalTimeout.
257
+ *
258
+ * <p>If there are no configurations, Retries and LROs have the default max attempt value of
259
+ * {@code 0}. LRO polling does not use this value by default.
260
+ *
261
+ * <p>The first RPC invocation will be considered attempt #0. Subsequent calls (retries) will
262
+ * increment the number of attempts and the number of attempts will not exceed this value.
199
263
*/
200
264
public abstract Builder setMaxAttempts (int maxAttempts );
201
265
@@ -215,49 +279,80 @@ public abstract static class Builder {
215
279
216
280
/**
217
281
* InitialRpcTimeout controls the timeout for the initial RPC. Subsequent calls will use this
218
- * value adjusted according to the RpcTimeoutMultiplier. The default value is {@code
219
- * Duration.ZERO}.
282
+ * value adjusted according to the RpcTimeoutMultiplier. RPC Timeout value of {@code
283
+ * Duration.ZERO} allows the RPC to continue indefinitely (until it hits a Connect Timeout or
284
+ * the connection has been terminated).
285
+ *
286
+ * <p>If there are no configurations, Retries have the default initial RPC timeout value of
287
+ * {@code Duration.ZERO}. LRO polling does not use the Initial RPC Timeout value.
220
288
*/
221
289
public abstract Builder setInitialRpcTimeout (Duration initialTimeout );
222
290
223
291
/**
224
- * See the class documentation of {@link RetrySettings} for a description of what this value
225
- * does. The default value is {@code 1.0}.
292
+ * RpcTimeoutMultiplier controls the change in RPC timeout. The timeout of the previous call is
293
+ * multiplied by the RpcTimeoutMultiplier to calculate the timeout for the next call.
294
+ *
295
+ * <p>If there are no configurations, Retries have the default RPC Timeout Multiplier value of
296
+ * {@code 1.0}. LRO polling does not use the RPC Timeout Multiplier value.
226
297
*/
227
298
public abstract Builder setRpcTimeoutMultiplier (double multiplier );
228
299
229
300
/**
230
301
* MaxRpcTimeout puts a limit on the value of the RPC timeout, so that the RpcTimeoutMultiplier
231
- * can't increase the RPC timeout higher than this amount. The default value is {@code
232
- * Duration.ZERO}.
302
+ * can't increase the RPC timeout higher than this amount.
303
+ *
304
+ * <p>If there are no configurations, Retries have the default Max RPC Timeout value of {@code
305
+ * Duration.ZERO}. LRO polling does not use the Max RPC Timeout value.
233
306
*/
234
307
public abstract Builder setMaxRpcTimeout (Duration maxTimeout );
235
308
236
309
/**
237
310
* TotalTimeout has ultimate control over how long the logic should keep trying the remote call
238
- * until it gives up completely. The higher the total timeout, the more retries can be
239
- * attempted. The default value is {@code Duration.ZERO}.
311
+ * until it gives up completely. The higher the total timeout, the more retries and polls can be
312
+ * attempted. If this value is {@code Duration.ZERO}, then the logic will instead use the number
313
+ * of attempts to determine retries. In the event that both maxAttempts and totalTimeout values
314
+ * are both 0, the logic will not retry. If this value is non-{@code Duration.ZERO}, and the
315
+ * retry duration has reaches the timeout value, the logic will give up retrying even the number
316
+ * of attempts is lower than the maxAttempts value.
317
+ *
318
+ * <p>If there are no configurations, Retries have the default timeout value of {@code
319
+ * Duration.ZERO} and LROs have a default total timeout value of {@code
320
+ * Duration.ofMillis(300000)} (5 minutes).
240
321
*/
241
322
public abstract Duration getTotalTimeout ();
242
323
243
324
/**
244
- * InitialRetryDelay controls the delay before the first retry. Subsequent retries will use this
245
- * value adjusted according to the RetryDelayMultiplier. The default value is {@code
246
- * Duration.ZERO}.
325
+ * InitialRetryDelay controls the delay before the first retry/ poll. Subsequent retries and
326
+ * polls will use this value adjusted according to the RetryDelayMultiplier.
327
+ *
328
+ * <p>If there are no configurations, Retries have the default initial retry delay value of
329
+ * {@code Duration.ZERO} and LROs have a default initial poll delay value of {@code
330
+ * Duration.ofMillis(5000)} (5 seconds).
247
331
*/
248
332
public abstract Duration getInitialRetryDelay ();
249
333
250
334
/**
251
- * RetryDelayMultiplier controls the change in retry delay. The retry delay of the previous call
252
- * is multiplied by the RetryDelayMultiplier to calculate the retry delay for the next call. The
253
- * default value is {@code 1.0}.
335
+ * RetryDelayMultiplier controls the change in delay before the next retry or poll. The retry
336
+ * delay of the previous call is multiplied by the RetryDelayMultiplier to calculate the retry
337
+ * delay for the next call.
338
+ *
339
+ * <p>If there are no configurations, Retries have the default retry delay multiplier value of
340
+ * {@code 1.0} and LROs have a default retry delay multiplier of {@code 1.5}.
254
341
*/
255
342
public abstract double getRetryDelayMultiplier ();
256
343
257
344
/**
258
- * MaxAttempts defines the maximum number of attempts to perform. The default value is {@code
259
- * 0}. If this value is greater than 0, and the number of attempts reaches this limit, the logic
260
- * will give up retrying even if the total retry time is still lower than TotalTimeout.
345
+ * MaxAttempts defines the maximum number of retry attempts to perform. If this value is set to
346
+ * 0, the logic will instead use the totalTimeout value to determine retries. In the event that
347
+ * both the maxAttempts and totalTimeout values are both 0, the logic will not retry. If this
348
+ * value is greater than 0, and the number of attempts exceeds this limit, the logic will give
349
+ * up retrying even if the total retry time is still lower than totalTimeout.
350
+ *
351
+ * <p>If there are no configurations, Retries and LROs have the default max attempt value of
352
+ * {@code 0}. LRO polling does not use this value by default.
353
+ *
354
+ * <p>The first RPC invocation will be considered attempt #0. Subsequent calls (retries) will
355
+ * increment the number of attempts and the number of attempts will not exceed this value.
261
356
*/
262
357
public abstract int getMaxAttempts ();
263
358
@@ -273,27 +368,40 @@ public abstract static class Builder {
273
368
274
369
/**
275
370
* MaxRetryDelay puts a limit on the value of the retry delay, so that the RetryDelayMultiplier
276
- * can't increase the retry delay higher than this amount. The default value is {@code
277
- * Duration.ZERO}.
371
+ * can't increase the retry delay higher than this amount.
372
+ *
373
+ * <p>If there are no configurations, Retries have the default max retry delay value of {@code
374
+ * Duration.ZERO} and LROs have a default max poll retry delay value of {@code
375
+ * Duration.ofMillis(45000)} (45 seconds).
278
376
*/
279
377
public abstract Duration getMaxRetryDelay ();
280
378
281
379
/**
282
380
* InitialRpcTimeout controls the timeout for the initial RPC. Subsequent calls will use this
283
- * value adjusted according to the RpcTimeoutMultiplier. The default value is {@code
284
- * Duration.ZERO}.
381
+ * value adjusted according to the RpcTimeoutMultiplier. RPC Timeout value of {@code
382
+ * Duration.ZERO} allows the RPC to continue indefinitely (until it hits a Connect Timeout or
383
+ * the connection has been terminated).
384
+ *
385
+ * <p>If there are no configurations, Retries have the default initial RPC timeout value of
386
+ * {@code Duration.ZERO}. LRO polling does not use the Initial RPC Timeout value.
285
387
*/
286
388
public abstract Duration getInitialRpcTimeout ();
287
389
288
390
/**
289
- * See the class documentation of {@link RetrySettings} for a description of what this value
290
- * does. The default value is {@code 1.0}.
391
+ * RpcTimeoutMultiplier controls the change in RPC timeout. The timeout of the previous call is
392
+ * multiplied by the RpcTimeoutMultiplier to calculate the timeout for the next call.
393
+ *
394
+ * <p>If there are no configurations, Retries have the default RPC Timeout Multiplier value of
395
+ * {@code 1.0}. LRO polling does not use the RPC Timeout Multiplier value.
291
396
*/
292
397
public abstract double getRpcTimeoutMultiplier ();
293
398
294
399
/**
295
400
* MaxRpcTimeout puts a limit on the value of the RPC timeout, so that the RpcTimeoutMultiplier
296
401
* can't increase the RPC timeout higher than this amount.
402
+ *
403
+ * <p>If there are no configurations, Retries have the default Max RPC Timeout value of {@code
404
+ * Duration.ZERO}. LRO polling does not use the Max RPC Timeout value.
297
405
*/
298
406
public abstract Duration getMaxRpcTimeout ();
299
407
0 commit comments