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

public Interface AsyncExecRuntime

Known Direct Implementers
org.apache.hc.client5.http.impl.async.InternalH2AsyncExecRuntime, org.apache.hc.client5.http.impl.async.InternalHttpAsyncExecRuntime
Annotations
@Internal
Imports
org.apache.hc.client5.http.HttpRoute, org.apache.hc.client5.http.protocol.HttpClientContext, org.apache.hc.core5.annotation.Internal, org.apache.hc.core5.concurrent.Cancellable, .FutureCallback, org.apache.hc.core5.http.nio.AsyncClientExchangeHandler, org.apache.hc.core5.util.TimeValue

Execution runtime that provides access to the underlying connection endpoint and helps manager its life cycle.

This interface is considered internal and generally ought not be used or accessed by custom request exec handlers.

Since
5.0

Method Summary

Modifier and TypeMethod and Description
public Cancellable

Returns:

handle that can be used to cancel the operation.
acquireEndpoint
(String
unique operation ID or null.
id
,
HttpRoute
the connection route.
route
,
Object
the expected connection state. May be null if connection can be state-less or its state is irrelevant.
state
,
HttpClientContext
the execution context.
context
,
FutureCallback<AsyncExecRuntime>
the result callback.
callback
)

Initiates operation to acquire a connection endpoint.

public Cancellable

Returns:

handle that can be used to cancel the operation.
connectEndpoint
(HttpClientContext
the execution context.
context
,
FutureCallback<AsyncExecRuntime>
the result callback.
callback
)

Initiates operation to connect the local endpoint to the initial hop (connection target in case of a direct route or to the first proxy hop in case of a route via a proxy or multiple proxies).

public void
discardEndpoint()

Shuts down and discards the acquired endpoint.

public void
disconnectEndpoint()

Disconnects the local endpoint from the initial hop in the connection route.

public Cancellable
execute(String
unique operation ID or null.
id
,
AsyncClientExchangeHandler
the client message handler.
exchangeHandler
,
HttpClientContext
the execution context.
context
)

Initiates a message exchange using the given handler.

public AsyncExecRuntime

Returns:

another runtime with the same configuration.
fork
()

Forks this runtime for parallel execution.

public boolean

Returns:

true if an endpoint has been acquired, false otherwise.
isEndpointAcquired
()

Determines of a connection endpoint has been acquired.

public boolean

Returns:

true if the endpoint is connected, false otherwise.
isEndpointConnected
()

Determines of there the endpoint is connected to the initial hop (connection target in case of a direct route or to the first proxy hop in case of a route via a proxy or multiple proxies).

public void
markConnectionNonReusable()

Marks the connection as non re-usable.

public void
markConnectionReusable(Object
the connection state representation or null if stateless.
state
,
TimeValue
the period of time this connection is valid for.
validityTime
)

Marks the connection as potentially re-usable for the given period of time and also marks it as stateful if the state representation is given.

public void
releaseEndpoint()

Releases the acquired endpoint potentially making it available for re-use.

public void
upgradeTls(HttpClientContext
the execution context.
context
)

Upgrades transport security of the active connection by using the TLS security protocol.

public default void
upgradeTls(HttpClientContext
the execution context.
context
,
FutureCallback<AsyncExecRuntime> callback)

Upgrades transport security of the active connection by using the TLS security protocol.

public boolean

Returns:

true if the connection is valid, false.
validateConnection
()

Validates the connection making sure it can be used to execute requests.

Method Detail

acquireEndpointback to summary
public Cancellable acquireEndpoint(String id, HttpRoute route, Object state, HttpClientContext context, FutureCallback<AsyncExecRuntime> callback)

Initiates operation to acquire a connection endpoint. Endpoints can leased from a pool or unconnected new endpoint can be created.

Parameters
id:String

unique operation ID or null.

route:HttpRoute

the connection route.

state:Object

the expected connection state. May be null if connection can be state-less or its state is irrelevant.

context:HttpClientContext

the execution context.

callback:FutureCallback<AsyncExecRuntime>

the result callback.

Returns:Cancellable

handle that can be used to cancel the operation.

connectEndpointback to summary
public Cancellable connectEndpoint(HttpClientContext context, FutureCallback<AsyncExecRuntime> callback)

Initiates operation to connect the local endpoint to the initial hop (connection target in case of a direct route or to the first proxy hop in case of a route via a proxy or multiple proxies).

Parameters
context:HttpClientContext

the execution context.

callback:FutureCallback<AsyncExecRuntime>

the result callback.

Returns:Cancellable

handle that can be used to cancel the operation.

discardEndpointback to summary
public void discardEndpoint()

Shuts down and discards the acquired endpoint.

disconnectEndpointback to summary
public void disconnectEndpoint()

Disconnects the local endpoint from the initial hop in the connection route.

executeback to summary
public Cancellable execute(String id, AsyncClientExchangeHandler exchangeHandler, HttpClientContext context)

Initiates a message exchange using the given handler.

Parameters
id:String

unique operation ID or null.

exchangeHandler:AsyncClientExchangeHandler

the client message handler.

context:HttpClientContext

the execution context.

forkback to summary
public AsyncExecRuntime fork()

Forks this runtime for parallel execution.

Returns:AsyncExecRuntime

another runtime with the same configuration.

isEndpointAcquiredback to summary
public boolean isEndpointAcquired()

Determines of a connection endpoint has been acquired.

Returns:boolean

true if an endpoint has been acquired, false otherwise.

isEndpointConnectedback to summary
public boolean isEndpointConnected()

Determines of there the endpoint is connected to the initial hop (connection target in case of a direct route or to the first proxy hop in case of a route via a proxy or multiple proxies).

Returns:boolean

true if the endpoint is connected, false otherwise.

markConnectionNonReusableback to summary
public void markConnectionNonReusable()

Marks the connection as non re-usable.

markConnectionReusableback to summary
public void markConnectionReusable(Object state, TimeValue validityTime)

Marks the connection as potentially re-usable for the given period of time and also marks it as stateful if the state representation is given.

Parameters
state:Object

the connection state representation or null if stateless.

validityTime:TimeValue

the period of time this connection is valid for.

releaseEndpointback to summary
public void releaseEndpoint()

Releases the acquired endpoint potentially making it available for re-use.

upgradeTlsback to summary
public void upgradeTls(HttpClientContext context)

Upgrades transport security of the active connection by using the TLS security protocol.

Parameters
context:HttpClientContext

the execution context.

upgradeTlsback to summary
public default void upgradeTls(HttpClientContext context, FutureCallback<AsyncExecRuntime> callback)

Upgrades transport security of the active connection by using the TLS security protocol.

Parameters
context:HttpClientContext

the execution context.

Since
5.2
validateConnectionback to summary
public boolean validateConnection()

Validates the connection making sure it can be used to execute requests.

Returns:boolean

true if the connection is valid, false.