public class DefaultRetryPolicy extends Object implements RetryPolicy
BceClientConfiguration. This class is
immutable, therefore safe to be shared by multiple clients.BceClientConfigurationDEFAULT_MAX_DELAY_IN_MILLIS, DEFAULT_MAX_ERROR_RETRY, DEFAULT_RETRY_POLICY| Constructor and Description |
|---|
DefaultRetryPolicy()
Constructs a new DefaultRetryPolicy.
|
DefaultRetryPolicy(int maxErrorRetry,
long maxDelayInMillis)
Constructs a new retry policy.
|
| Modifier and Type | Method and Description |
|---|---|
long |
getDelayBeforeNextRetryInMillis(BceClientException exception,
int retriesAttempted)
Returns the delay (in milliseconds) before next retry attempt.
|
long |
getMaxDelayInMillis()
Returns the maximum delay time (in milliseconds) before retrying a request.
|
int |
getMaxErrorRetry()
Returns the maximum number of retry attempts.
|
protected boolean |
shouldRetry(BceClientException exception,
int retriesAttempted)
Returns whether a failed request should be retried according to the given request context.
|
public DefaultRetryPolicy()
public DefaultRetryPolicy(int maxErrorRetry,
long maxDelayInMillis)
maxErrorRetry - Maximum number of retry attempts for failed requests.maxDelayInMillis - Maximum delay time (in milliseconds) before next retry attempt.BceClientConfigurationpublic int getMaxErrorRetry()
getMaxErrorRetry in interface RetryPolicypublic long getMaxDelayInMillis()
getMaxDelayInMillis in interface RetryPolicypublic long getDelayBeforeNextRetryInMillis(BceClientException exception, int retriesAttempted)
getDelayBeforeNextRetryInMillis in interface RetryPolicyexception - the exception from the failed request, represented as an BceClientException object.retriesAttempted - the number of times the current request has been attempted
(not including the next attempt after the delay).protected boolean shouldRetry(BceClientException exception, int retriesAttempted)
exception - the exception from the failed request, represented as a BceClientException object.retriesAttempted - the number of times the current request has been attempted.Copyright © 2024. All rights reserved.