|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.baidubce.http.DefaultRetryPolicy
public class DefaultRetryPolicy
Retry policy that can be configured on a specific service client using BceClientConfiguration
. This class is
immutable, therefore safe to be shared by multiple clients.
BceClientConfiguration
Field Summary |
---|
Fields inherited from interface com.baidubce.http.RetryPolicy |
---|
DEFAULT_MAX_DELAY_IN_MILLIS, DEFAULT_MAX_ERROR_RETRY, DEFAULT_RETRY_POLICY |
Constructor Summary | |
---|---|
DefaultRetryPolicy()
Constructs a new DefaultRetryPolicy. |
|
DefaultRetryPolicy(int maxErrorRetry,
long maxDelayInMillis)
Constructs a new retry policy. |
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
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.BceClientConfiguration
Method Detail |
---|
public int getMaxErrorRetry()
getMaxErrorRetry
in interface RetryPolicy
public long getMaxDelayInMillis()
getMaxDelayInMillis
in interface RetryPolicy
public long getDelayBeforeNextRetryInMillis(BceClientException exception, int retriesAttempted)
getDelayBeforeNextRetryInMillis
in interface RetryPolicy
exception
- 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.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |