Package org.apache.hc.client5.http
Interface HttpRequestRetryStrategy
-
- All Known Implementing Classes:
DefaultHttpRequestRetryStrategy
@Contract(threading=STATELESS) public interface HttpRequestRetryStrategy
Strategy interface that allows API users to plug in their own logic to control whether or not a retry should automatically be done, how many times it should be done and so on.- Since:
- 5.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default org.apache.hc.core5.util.TimeValue
getRetryInterval(org.apache.hc.core5.http.HttpRequest request, java.io.IOException exception, int execCount, org.apache.hc.core5.http.protocol.HttpContext context)
Determines the retry interval between subsequent retries.org.apache.hc.core5.util.TimeValue
getRetryInterval(org.apache.hc.core5.http.HttpResponse response, int execCount, org.apache.hc.core5.http.protocol.HttpContext context)
Determines the retry interval between subsequent retries.boolean
retryRequest(org.apache.hc.core5.http.HttpRequest request, java.io.IOException exception, int execCount, org.apache.hc.core5.http.protocol.HttpContext context)
Determines if a method should be retried after an I/O exception occurred during execution.boolean
retryRequest(org.apache.hc.core5.http.HttpResponse response, int execCount, org.apache.hc.core5.http.protocol.HttpContext context)
Determines if a method should be retried given the response from the target server.
-
-
-
Method Detail
-
retryRequest
boolean retryRequest(org.apache.hc.core5.http.HttpRequest request, java.io.IOException exception, int execCount, org.apache.hc.core5.http.protocol.HttpContext context)
Determines if a method should be retried after an I/O exception occurred during execution.- Parameters:
request
- the request failed due to an I/O exceptionexception
- the exception that occurredexecCount
- the number of times this method has been unsuccessfully executedcontext
- the context for the request execution- Returns:
true
if the request should be retried,false
otherwise
-
retryRequest
boolean retryRequest(org.apache.hc.core5.http.HttpResponse response, int execCount, org.apache.hc.core5.http.protocol.HttpContext context)
Determines if a method should be retried given the response from the target server.- Parameters:
response
- the response from the target serverexecCount
- the number of times this method has been unsuccessfully executedcontext
- the context for the request execution- Returns:
true
if the request should be retried,false
otherwise
-
getRetryInterval
default org.apache.hc.core5.util.TimeValue getRetryInterval(org.apache.hc.core5.http.HttpRequest request, java.io.IOException exception, int execCount, org.apache.hc.core5.http.protocol.HttpContext context)
Determines the retry interval between subsequent retries.- Parameters:
request
- the request failed due to an I/O exceptionexception
- the exception that occurredexecCount
- the number of times this method has been unsuccessfully executedcontext
- the context for the request execution- Returns:
- the retry interval between subsequent retries
-
getRetryInterval
org.apache.hc.core5.util.TimeValue getRetryInterval(org.apache.hc.core5.http.HttpResponse response, int execCount, org.apache.hc.core5.http.protocol.HttpContext context)
Determines the retry interval between subsequent retries.- Parameters:
response
- the response from the target serverexecCount
- the number of times this method has been unsuccessfully executedcontext
- the context for the request execution- Returns:
- the retry interval between subsequent retries
-
-