Class AsyncHttpRequestRetryExec
- java.lang.Object
-
- org.apache.hc.client5.http.impl.async.AsyncHttpRequestRetryExec
-
- All Implemented Interfaces:
AsyncExecChainHandler
@Contract(threading=STATELESS) @Internal public final class AsyncHttpRequestRetryExec extends java.lang.Object implements AsyncExecChainHandler
Request executor in the asynchronous request execution chain that is responsible for making a decision whether a request that failed due to an I/O exception or received a specific response from the target server should be re-executed. Note that this exec chain handler will not respectHttpRequestRetryStrategy.getRetryInterval(HttpResponse, int, org.apache.hc.core5.http.protocol.HttpContext)
.Further responsibilities such as communication with the opposite endpoint is delegated to the next executor in the request execution chain.
If this handler is active, pay particular attention to the placement of other handlers within the handler chain relative to the retry handler. Use
ChainElement.RETRY
as name when referring to this handler.If a custom handler is placed before the retry handler, the handler will see the initial request and the final outcome after the last retry. Elapsed time will account for any delays imposed by the retry handler.
A custom handler which is placed after the retry handler will be invoked for each individual retry. Elapsed time will measure each individual http request, without the delay imposed by the retry handler.
- Since:
- 5.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
AsyncHttpRequestRetryExec.State
-
Field Summary
Fields Modifier and Type Field Description private static org.slf4j.Logger
LOG
private HttpRequestRetryStrategy
retryStrategy
-
Constructor Summary
Constructors Constructor Description AsyncHttpRequestRetryExec(HttpRequestRetryStrategy retryStrategy)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
execute(org.apache.hc.core5.http.HttpRequest request, org.apache.hc.core5.http.nio.AsyncEntityProducer entityProducer, AsyncExecChain.Scope scope, AsyncExecChain chain, AsyncExecCallback asyncExecCallback)
Executes the actual HTTP request.private void
internalExecute(AsyncHttpRequestRetryExec.State state, org.apache.hc.core5.http.HttpRequest request, org.apache.hc.core5.http.nio.AsyncEntityProducer entityProducer, AsyncExecChain.Scope scope, AsyncExecChain chain, AsyncExecCallback asyncExecCallback)
-
-
-
Field Detail
-
LOG
private static final org.slf4j.Logger LOG
-
retryStrategy
private final HttpRequestRetryStrategy retryStrategy
-
-
Constructor Detail
-
AsyncHttpRequestRetryExec
public AsyncHttpRequestRetryExec(HttpRequestRetryStrategy retryStrategy)
-
-
Method Detail
-
internalExecute
private void internalExecute(AsyncHttpRequestRetryExec.State state, org.apache.hc.core5.http.HttpRequest request, org.apache.hc.core5.http.nio.AsyncEntityProducer entityProducer, AsyncExecChain.Scope scope, AsyncExecChain chain, AsyncExecCallback asyncExecCallback) throws org.apache.hc.core5.http.HttpException, java.io.IOException
- Throws:
org.apache.hc.core5.http.HttpException
java.io.IOException
-
execute
public void execute(org.apache.hc.core5.http.HttpRequest request, org.apache.hc.core5.http.nio.AsyncEntityProducer entityProducer, AsyncExecChain.Scope scope, AsyncExecChain chain, AsyncExecCallback asyncExecCallback) throws org.apache.hc.core5.http.HttpException, java.io.IOException
Description copied from interface:AsyncExecChainHandler
Executes the actual HTTP request. The handler can choose to return a response message immediately inside the call or asynchronously at some later point or delegate request execution to the next element in the execution chain.- Specified by:
execute
in interfaceAsyncExecChainHandler
- Parameters:
request
- the actual request.entityProducer
- the request entity producer ornull
if the request does not enclose an entity.scope
- the execution scope .chain
- the next element in the request execution chain.asyncExecCallback
- the execution callback.- Throws:
org.apache.hc.core5.http.HttpException
java.io.IOException
-
-