protected long getDelayBeforeNextRetryInMillis ( HttpRequestBase method , BceClientException exception , int attempt , RetryPolicy retryPolicy ) { int retries = attempt - 1 ; int maxErrorRetry = retryPolicy . getMaxErrorRetry ( ) ; // Immediately fails when it has exceeds the max retry count. if ( retries >= maxErrorRetry ) { return - 1 ; } // Never retry on requests containing non-repeatable entity if ( method instanceof HttpEntityEnclosingRequest ) { HttpEntity entity = ( ( HttpEntityEnclosingRequest ) method ) . getEntity ( ) ; if ( entity != null && ! entity . isRepeatable ( ) ) { logger . debug ( "Entity not repeatable, stop retrying" ) ; return - 1 ; } } return Math . min ( retryPolicy . getMaxDelayInMillis ( ) , retryPolicy . getDelayBeforeNextRetryInMillis ( exception , retries ) ) ; }
Get delay time before next retry .