public class ExponentialBackoffPolicy extends Object implements RetryPolicy
This policy retries up to a maximum number of times with exponential backoff, and adds random jitter to prevent thundering herd problems when multiple clients retry simultaneously.
Wait time calculation: base_wait = 2^(attempt-1) seconds With jitter: final_wait = base_wait + (base_wait * 0.1 * random) Max wait time: 64 seconds
| Modifier and Type | Field and Description |
|---|---|
static ExponentialBackoffPolicy |
INSTANCE |
| Modifier and Type | Method and Description |
|---|---|
long |
getRetryWaitTime(int attempt)
Calculates the wait time before the next retry attempt.
|
boolean |
shouldRetry(Exception e,
int attempt)
Determines whether an operation should be retried based on the exception and attempt count.
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitwaitForNextRetrypublic static final ExponentialBackoffPolicy INSTANCE
public boolean shouldRetry(Exception e, int attempt)
RetryPolicyshouldRetry in interface RetryPolicye - The exception that occurredattempt - The current attempt number (1-based)public long getRetryWaitTime(int attempt)
RetryPolicygetRetryWaitTime in interface RetryPolicyattempt - The current attempt number (1-based)Copyright © 2026 Alibaba Cloud Computing. All rights reserved.