public class RetryHandler extends Object
This handler provides retry capabilities based on HTTP status codes:
All retry strategies include jitter to prevent thundering herd problems when multiple clients retry simultaneously.
| Modifier and Type | Class and Description |
|---|---|
static interface |
RetryHandler.RetryLogger
Functional interface for logging retry attempts.
|
| Constructor and Description |
|---|
RetryHandler() |
RetryHandler(RetryHandler.RetryLogger retryLogger) |
RetryHandler(RetryPolicy defaultRetryPolicy,
RetryHandler.RetryLogger retryLogger) |
| Modifier and Type | Method and Description |
|---|---|
<T> T |
executeWithRetry(Callable<T> action)
Executes an action with retry logic.
|
<T> T |
executeWithRetry(Callable<T> action,
IntConsumer errorCodeHandler)
Executes an action with retry logic and error code handler.
|
public RetryHandler()
public RetryHandler(RetryPolicy defaultRetryPolicy, RetryHandler.RetryLogger retryLogger)
public RetryHandler(RetryHandler.RetryLogger retryLogger)
public <T> T executeWithRetry(Callable<T> action) throws Exception
T - The return type of the actionaction - The action to executeException - if the action fails after all retriespublic <T> T executeWithRetry(Callable<T> action, IntConsumer errorCodeHandler) throws Exception
T - The return type of the actionaction - The action to executeerrorCodeHandler - Handler for error codes (called before each retry)Exception - if the action fails after all retriesCopyright © 2026 Alibaba Cloud Computing. All rights reserved.