code: protected boolean shouldRetry(BceClientException exception, int retriesAttempted) {
          // Always retry on client exceptions caused by IOException
          if (exception.getCause() instanceof IOException) {
              logger.debug("Retry for IOException.");
              return true;
          }
  
          // Only retry on a subset of service exceptions
          if (exception instanceof BceServiceException) {
              BceServiceException e = (BceServiceException) exception;
  
              /*
               * For 500 internal server errors and 503 service unavailable errors and 502 service bad gateway, we want to retry, but we need to use
               * an exponential back-off strategy so that we don't overload a server with a flood of retries.
               */
              if (e.getStatusCode() == HttpStatus.SC_INTERNAL_SERVER_ERROR) {
                  logger.debug("Retry for internal server error.");
                  return true;
              }
              if (e.getStatusCode() == HttpStatus.SC_BAD_GATEWAY) {
                  logger.debug("Retry for bad gateway.");
                  return true;
              }
              if (e.getStatusCode() == HttpStatus.SC_SERVICE_UNAVAILABLE) {
                  logger.debug("Retry for service unavailable.");
                  return true;
              }
  
              String errorCode = e.getErrorCode();
              if (ErrorCode.REQUEST_EXPIRED.equals(errorCode)) {
                  logger.debug("Retry for request expired.");
                  return true;
              }
          }
  
          return false;
      }
docs: 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:
  <ul>
  <li>if it has already reached the max retry limit,
  <li>if the request contains non-repeatable content,
  <li>if any RuntimeException or Error is thrown when executing the request.
  </ul>
  
  @param exception        the exception from the failed request, represented as a BceClientException object.
  @param retriesAttempted the number of times the current request has been attempted.
  @return true if the failed request should be retried.