Class ExponentialBackoffRetryStrategy
java.lang.Object
org.apache.hc.client5.http.impl.DefaultHttpRequestRetryStrategy
com.cloudbees.jenkins.plugins.bitbucket.impl.client.ExponentialBackoffRetryStrategy
- All Implemented Interfaces:
- org.apache.hc.client5.http.HttpRequestRetryStrategy
@Contract(threading=SAFE)
public class ExponentialBackoffRetryStrategy
extends org.apache.hc.client5.http.impl.DefaultHttpRequestRetryStrategy
An implementation that backs off exponentially based on the number of
 consecutive failed attempts. It uses the following defaults:
 
         no delay in case it was never tried or didn't fail so far
     6 secs delay for one failed attempt (= initialExpiryInMillis)
    60 secs delay for two failed attempts
    10 mins delay for three failed attempts
   100 mins delay for four failed attempts
  ~16 hours delay for five failed attempts
   24 hours delay for six or more failed attempts (= maxExpiryInMillis)
 
 The following equation is used to calculate the delay for a specific revalidation request:
 
     delay = initialExpiryInMillis * Math.pow(backOffRate, AsynchronousValidationRequest.getConsecutiveFailedAttempts() - 1))
 
 The resulting delay won't exceed maxExpiryInMillis.- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final longstatic final longstatic final longFields inherited from class org.apache.hc.client5.http.impl.DefaultHttpRequestRetryStrategyINSTANCE
- 
Constructor SummaryConstructorsConstructorDescriptionCreate a new strategy using a fixed pool of worker threads.ExponentialBackoffRetryStrategy(long backOffRate, long initialExpiryInMillis, long maxExpiryInMillis) Create a new strategy by using a fixed pool of worker threads and the given parameters to calculated the delay.
- 
Method SummaryModifier and TypeMethodDescriptionorg.apache.hc.core5.util.TimeValuegetRetryInterval(org.apache.hc.core5.http.HttpRequest request, IOException exception, int execCount, org.apache.hc.core5.http.protocol.HttpContext context) org.apache.hc.core5.util.TimeValuegetRetryInterval(org.apache.hc.core5.http.HttpResponse response, int execCount, org.apache.hc.core5.http.protocol.HttpContext context) booleanretryRequest(org.apache.hc.core5.http.HttpRequest request, IOException exception, int execCount, org.apache.hc.core5.http.protocol.HttpContext context) booleanretryRequest(org.apache.hc.core5.http.HttpResponse response, int executionCount, org.apache.hc.core5.http.protocol.HttpContext context) Methods inherited from class org.apache.hc.client5.http.impl.DefaultHttpRequestRetryStrategyhandleAsIdempotent
- 
Field Details- 
DEFAULT_BACK_OFF_RATEpublic static final long DEFAULT_BACK_OFF_RATE- See Also:
 
- 
DEFAULT_INITIAL_EXPIRY_IN_MILLISpublic static final long DEFAULT_INITIAL_EXPIRY_IN_MILLIS
- 
DEFAULT_MAX_EXPIRY_IN_MILLISpublic static final long DEFAULT_MAX_EXPIRY_IN_MILLIS
 
- 
- 
Constructor Details- 
ExponentialBackoffRetryStrategypublic ExponentialBackoffRetryStrategy()Create a new strategy using a fixed pool of worker threads.
- 
ExponentialBackoffRetryStrategypublic ExponentialBackoffRetryStrategy(long backOffRate, long initialExpiryInMillis, long maxExpiryInMillis) Create a new strategy by using a fixed pool of worker threads and the given parameters to calculated the delay.- Parameters:
- backOffRate- the back off rate to be used; not negative
- initialExpiryInMillis- the initial expiry in milli seconds; not negative
- maxExpiryInMillis- the upper limit of the delay in milli seconds; not negative
 
 
- 
- 
Method Details- 
retryRequestpublic boolean retryRequest(org.apache.hc.core5.http.HttpResponse response, int executionCount, org.apache.hc.core5.http.protocol.HttpContext context) - Specified by:
- retryRequestin interface- org.apache.hc.client5.http.HttpRequestRetryStrategy
- Overrides:
- retryRequestin class- org.apache.hc.client5.http.impl.DefaultHttpRequestRetryStrategy
 
- 
retryRequestpublic boolean retryRequest(org.apache.hc.core5.http.HttpRequest request, IOException exception, int execCount, org.apache.hc.core5.http.protocol.HttpContext context) - Specified by:
- retryRequestin interface- org.apache.hc.client5.http.HttpRequestRetryStrategy
- Overrides:
- retryRequestin class- org.apache.hc.client5.http.impl.DefaultHttpRequestRetryStrategy
 
- 
getRetryIntervalpublic org.apache.hc.core5.util.TimeValue getRetryInterval(org.apache.hc.core5.http.HttpRequest request, IOException exception, int execCount, org.apache.hc.core5.http.protocol.HttpContext context) 
- 
getRetryIntervalpublic org.apache.hc.core5.util.TimeValue getRetryInterval(org.apache.hc.core5.http.HttpResponse response, int execCount, org.apache.hc.core5.http.protocol.HttpContext context) - Specified by:
- getRetryIntervalin interface- org.apache.hc.client5.http.HttpRequestRetryStrategy
- Overrides:
- getRetryIntervalin class- org.apache.hc.client5.http.impl.DefaultHttpRequestRetryStrategy
 
 
-