Top Description Methods
org.apache.hc.client5.http

public Interface HttpRequestRetryStrategy

Known Direct Implementers
org.apache.hc.client5.http.impl.DefaultHttpRequestRetryStrategy
Annotations
@Contract
threading:STATELESS
Imports
java.io.IOException, org.apache.hc.core5.annotation.Contract, .ThreadingBehavior, org.apache.hc.core5.http.HttpRequest, .HttpResponse, org.apache.hc.core5.http.protocol.HttpContext, org.apache.hc.core5.util.TimeValue

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

Modifier and TypeMethod and Description
public default TimeValue

Returns:

the retry interval between subsequent retries
getRetryInterval
(HttpRequest
the request failed due to an I/O exception
request
,
IOException
the exception that occurred
exception
,
int
the number of times this method has been unsuccessfully executed
execCount
,
HttpContext
the context for the request execution
context
)

Determines the retry interval between subsequent retries.

public TimeValue

Returns:

the retry interval between subsequent retries
getRetryInterval
(HttpResponse
the response from the target server
response
,
int
the number of times this method has been unsuccessfully executed
execCount
,
HttpContext
the context for the request execution
context
)

Determines the retry interval between subsequent retries.

public boolean

Returns:

true if the request should be retried, false otherwise
retryRequest
(HttpRequest
the request failed due to an I/O exception
request
,
IOException
the exception that occurred
exception
,
int
the number of times this method has been unsuccessfully executed
execCount
,
HttpContext
the context for the request execution
context
)

Determines if a method should be retried after an I/O exception occurred during execution.

public boolean

Returns:

true if the request should be retried, false otherwise
retryRequest
(HttpResponse
the response from the target server
response
,
int
the number of times this method has been unsuccessfully executed
execCount
,
HttpContext
the context for the request execution
context
)

Determines if a method should be retried given the response from the target server.

Method Detail

getRetryIntervalback to summary
public default TimeValue getRetryInterval(HttpRequest request, IOException exception, int execCount, HttpContext context)

Determines the retry interval between subsequent retries.

Parameters
request:HttpRequest

the request failed due to an I/O exception

exception:IOException

the exception that occurred

execCount:int

the number of times this method has been unsuccessfully executed

context:HttpContext

the context for the request execution

Returns:TimeValue

the retry interval between subsequent retries

getRetryIntervalback to summary
public TimeValue getRetryInterval(HttpResponse response, int execCount, HttpContext context)

Determines the retry interval between subsequent retries.

Parameters
response:HttpResponse

the response from the target server

execCount:int

the number of times this method has been unsuccessfully executed

context:HttpContext

the context for the request execution

Returns:TimeValue

the retry interval between subsequent retries

retryRequestback to summary
public boolean retryRequest(HttpRequest request, IOException exception, int execCount, HttpContext context)

Determines if a method should be retried after an I/O exception occurred during execution.

Parameters
request:HttpRequest

the request failed due to an I/O exception

exception:IOException

the exception that occurred

execCount:int

the number of times this method has been unsuccessfully executed

context:HttpContext

the context for the request execution

Returns:boolean

true if the request should be retried, false otherwise

retryRequestback to summary
public boolean retryRequest(HttpResponse response, int execCount, HttpContext context)

Determines if a method should be retried given the response from the target server.

Parameters
response:HttpResponse

the response from the target server

execCount:int

the number of times this method has been unsuccessfully executed

context:HttpContext

the context for the request execution

Returns:boolean

true if the request should be retried, false otherwise