| 453 | private static final int RETRY_MAX_DELAY_MILLIS = 15000; |
| 454 | |
| 455 | private static int retryDelayMillis(int retryAttempt) { |
| 456 | // Calculate the max delay as base * 2 ^ (retryAttempt - 1). |
| 457 | int max = RETRY_BASE_DELAY_MILLIS * (1 << (retryAttempt - 1)); |
| 458 | max = Math.min(max, RETRY_MAX_DELAY_MILLIS); |
| 459 | |
| 460 | // To incorporate jitter, use a pseudo random delay between [max/2, max] millis. |
| 461 | return randomGenerator.nextInt(max / 2) + max / 2 + 1; |
| 462 | } |
| 463 | |
| 464 | private static final int[] RETRIABLE_STATUS_CODES = { |
| 465 | 408, // Request Timeout |