类 DefaultRetryPolicy

    • 构造器详细资料

      • DefaultRetryPolicy

        public DefaultRetryPolicy()
        Constructs a new DefaultRetryPolicy.
      • DefaultRetryPolicy

        public DefaultRetryPolicy​(int maxErrorRetry,
                                  long maxDelayInMillis)
        Constructs a new retry policy.
        参数:
        maxErrorRetry - Maximum number of retry attempts for failed requests.
        maxDelayInMillis - Maximum delay time (in milliseconds) before next retry attempt.
        另请参阅:
        BceClientConfiguration
    • 方法详细资料

      • getMaxErrorRetry

        public int getMaxErrorRetry()
        Returns the maximum number of retry attempts.
        指定者:
        getMaxErrorRetry 在接口中 RetryPolicy
        返回:
        The maximum number of retry attempts.
      • getMaxDelayInMillis

        public long getMaxDelayInMillis()
        Returns the maximum delay time (in milliseconds) before retrying a request.
        指定者:
        getMaxDelayInMillis 在接口中 RetryPolicy
        返回:
        the maximum delay time (in milliseconds) before retrying a request.
      • getDelayBeforeNextRetryInMillis

        public 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.
        指定者:
        getDelayBeforeNextRetryInMillis 在接口中 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).
        返回:
        the delay (in milliseconds) before next retry attempt.A negative value indicates that no more retries should be made.
      • shouldRetry

        protected boolean shouldRetry​(BceClientException exception,
                                      int retriesAttempted)
        Returns whether a failed request should be retried according to the given request context. In the following circumstances, the request will fail directly without consulting this method:
        • if it has already reached the max retry limit,
        • if the request contains non-repeatable content,
        • if any RuntimeException or Error is thrown when executing the request.
        参数:
        exception - the exception from the failed request, represented as a BceClientException object.
        retriesAttempted - the number of times the current request has been attempted.
        返回:
        true if the failed request should be retried.