Top Description Inners Fields Constructors Methods
org.apache.hc.client5.http.impl.async

public final Class AsyncHttpRequestRetryExec

extends Object
implements AsyncExecChainHandler
Class Inheritance
All Implemented Interfaces
org.apache.hc.client5.http.async.AsyncExecChainHandler
Annotations
@Contract
threading:STATELESS
@Internal
Imports
java.io.IOException, org.apache.hc.client5.http.HttpRequestRetryStrategy, .HttpRoute, org.apache.hc.client5.http.async.AsyncExecCallback, .AsyncExecChain, .AsyncExecChainHandler, org.apache.hc.client5.http.impl.ChainElement, org.apache.hc.client5.http.protocol.HttpClientContext, org.apache.hc.core5.annotation.Contract, .Internal, .ThreadingBehavior, org.apache.hc.core5.http.EntityDetails, .HttpException, .HttpRequest, .HttpResponse, org.apache.hc.core5.http.nio.AsyncDataConsumer, .AsyncEntityProducer, org.apache.hc.core5.http.nio.entity.DiscardingEntityConsumer, org.apache.hc.core5.http.support.BasicRequestBuilder, org.apache.hc.core5.util.Args, .TimeValue, org.slf4j.Logger, .LoggerFactory

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 respect HttpRequestRetryStrategy#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 and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private static final Logger
private final HttpRequestRetryStrategy

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
execute(final HttpRequest
the actual request.
request
,
final AsyncEntityProducer
the request entity producer or null if the request does not enclose an entity.
entityProducer
,
final AsyncExecChain.Scope
the execution scope .
scope
,
final AsyncExecChain
the next element in the request execution chain.
chain
,
final AsyncExecCallback
the execution callback.
asyncExecCallback
)

Implements org.apache.hc.client5.http.async.AsyncExecChainHandler.execute.

Executes the actual HTTP request.
private void
internalExecute(final AsyncHttpRequestRetryExec.State state, final HttpRequest request, final AsyncEntityProducer entityProducer, final AsyncExecChain.Scope scope, final AsyncExecChain chain, final AsyncExecCallback asyncExecCallback)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

LOGback to summary
private static final Logger LOG
retryStrategyback to summary
private final HttpRequestRetryStrategy retryStrategy

Constructor Detail

AsyncHttpRequestRetryExecback to summary
public AsyncHttpRequestRetryExec(final HttpRequestRetryStrategy retryStrategy)

Method Detail

executeback to summary
public void execute(final HttpRequest request, final AsyncEntityProducer entityProducer, final AsyncExecChain.Scope scope, final AsyncExecChain chain, final AsyncExecCallback asyncExecCallback) throws HttpException, IOException

Implements org.apache.hc.client5.http.async.AsyncExecChainHandler.execute.

Doc from org.apache.hc.client5.http.async.AsyncExecChainHandler.execute.

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.

Parameters
request:HttpRequest

the actual request.

entityProducer:AsyncEntityProducer

the request entity producer or null if the request does not enclose an entity.

scope:AsyncExecChain.Scope

the execution scope .

chain:AsyncExecChain

the next element in the request execution chain.

asyncExecCallback:AsyncExecCallback

the execution callback.

Annotations
@Override
internalExecuteback to summary
private void internalExecute(final AsyncHttpRequestRetryExec.State state, final HttpRequest request, final AsyncEntityProducer entityProducer, final AsyncExecChain.Scope scope, final AsyncExecChain chain, final AsyncExecCallback asyncExecCallback) throws HttpException, IOException
org.apache.hc.client5.http.impl.async back to summary

private Class AsyncHttpRequestRetryExec.State

extends Object
Class Inheritance
  • java.lang.Object
  • org.apache.hc.client5.http.impl.async.AsyncHttpRequestRetryExec.State

Field Summary

Modifier and TypeField and Description
pack-priv volatile TimeValue
pack-priv volatile boolean

Constructor Summary

AccessConstructor and Description
private

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

delayback to summary
pack-priv volatile TimeValue delay
retryingback to summary
pack-priv volatile boolean retrying

Constructor Detail

Stateback to summary
private State()