com.baidubce.http
Interface RetryPolicy

All Known Implementing Classes:
DefaultRetryPolicy

public interface RetryPolicy

Retry policy that can be configured on a specific service client using BceClientConfiguration.


Field Summary
static int DEFAULT_MAX_DELAY_IN_MILLIS
          Maximum exponential back-off time before retrying a request.
static int DEFAULT_MAX_ERROR_RETRY
          SDK default max retry count.
static DefaultRetryPolicy DEFAULT_RETRY_POLICY
          SDK default 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.
 

Field Detail

DEFAULT_MAX_ERROR_RETRY

static final int DEFAULT_MAX_ERROR_RETRY
SDK default max retry count.

See Also:
Constant Field Values

DEFAULT_MAX_DELAY_IN_MILLIS

static final int DEFAULT_MAX_DELAY_IN_MILLIS
Maximum exponential back-off time before retrying a request.

See Also:
Constant Field Values

DEFAULT_RETRY_POLICY

static final DefaultRetryPolicy DEFAULT_RETRY_POLICY
SDK default retry policy.

Method Detail

getMaxErrorRetry

int getMaxErrorRetry()
Returns the maximum number of retry attempts.

Returns:
The maximum number of retry attempts.

getMaxDelayInMillis

long getMaxDelayInMillis()
Returns the maximum delay time (in milliseconds) before retrying a request.

Returns:
the maximum delay time (in milliseconds) before retrying a request.

getDelayBeforeNextRetryInMillis

long getDelayBeforeNextRetryInMillis(BceClientException exception,
                                     int retriesAttempted)
Returns the delay (in milliseconds) before next retry attempt. A negative value indicates that no more retries should be made.

Parameters:
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).
Returns:
the delay (in milliseconds) before next retry attempt.A negative value indicates that no more retries should be made.


Copyright © 2018. All rights reserved.