Interface ExecRuntime
-
- All Known Implementing Classes:
InternalExecRuntime
@Internal public interface ExecRuntime
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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
acquireEndpoint(java.lang.String id, HttpRoute route, java.lang.Object state, HttpClientContext context)
Acquires a connection endpoint.void
connectEndpoint(HttpClientContext context)
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).void
discardEndpoint()
Shuts down and discards the acquired endpoint.void
disconnectEndpoint()
Disconnects the local endpoint from the initial hop in the connection route.org.apache.hc.core5.http.ClassicHttpResponse
execute(java.lang.String id, org.apache.hc.core5.http.ClassicHttpRequest request, HttpClientContext context)
Executes HTTP request using the given context.ExecRuntime
fork(org.apache.hc.core5.concurrent.CancellableDependency cancellableAware)
Forks this runtime for parallel execution.boolean
isConnectionReusable()
Determines of the connection is considered re-usable.boolean
isEndpointAcquired()
Determines of a connection endpoint has been acquired.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).boolean
isExecutionAborted()
Determines of the request execution has been aborted.void
markConnectionNonReusable()
Marks the connection as non re-usable.void
markConnectionReusable(java.lang.Object state, org.apache.hc.core5.util.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.void
releaseEndpoint()
Releases the acquired endpoint potentially making it available for re-use.void
upgradeTls(HttpClientContext context)
Upgrades transport security of the active connection by using the TLS security protocol.
-
-
-
Method Detail
-
isExecutionAborted
boolean isExecutionAborted()
Determines of the request execution has been aborted.- Returns:
true
if the request execution has been acquired,false
otherwise.
-
isEndpointAcquired
boolean isEndpointAcquired()
Determines of a connection endpoint has been acquired.- Returns:
true
if an endpoint has been acquired,false
otherwise.
-
acquireEndpoint
void acquireEndpoint(java.lang.String id, HttpRoute route, java.lang.Object state, HttpClientContext context) throws java.io.IOException
Acquires a connection endpoint. Endpoints can leased from a pool or unconnected new endpoint can be created.- Parameters:
id
- unique operation ID ornull
.route
- the connection route.state
- the expected connection state. May benull
if connection can be state-less or its state is irrelevant.context
- the execution context.- Throws:
java.io.IOException
-
releaseEndpoint
void releaseEndpoint()
Releases the acquired endpoint potentially making it available for re-use.
-
discardEndpoint
void discardEndpoint()
Shuts down and discards the acquired endpoint.
-
isEndpointConnected
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:
true
if the endpoint is connected,false
otherwise.
-
disconnectEndpoint
void disconnectEndpoint() throws java.io.IOException
Disconnects the local endpoint from the initial hop in the connection route.- Throws:
java.io.IOException
-
connectEndpoint
void connectEndpoint(HttpClientContext context) throws java.io.IOException
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
- the execution context.- Throws:
java.io.IOException
-
upgradeTls
void upgradeTls(HttpClientContext context) throws java.io.IOException
Upgrades transport security of the active connection by using the TLS security protocol.- Parameters:
context
- the execution context.- Throws:
java.io.IOException
-
execute
org.apache.hc.core5.http.ClassicHttpResponse execute(java.lang.String id, org.apache.hc.core5.http.ClassicHttpRequest request, HttpClientContext context) throws java.io.IOException, org.apache.hc.core5.http.HttpException
Executes HTTP request using the given context.- Parameters:
id
- unique operation ID ornull
.request
- the request message.context
- the execution context.- Throws:
java.io.IOException
org.apache.hc.core5.http.HttpException
-
isConnectionReusable
boolean isConnectionReusable()
Determines of the connection is considered re-usable.- Returns:
true
if the connection is re-usable,false
otherwise.
-
markConnectionReusable
void markConnectionReusable(java.lang.Object state, org.apache.hc.core5.util.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
- the connection state representation ornull
if stateless.validityTime
- the period of time this connection is valid for.
-
markConnectionNonReusable
void markConnectionNonReusable()
Marks the connection as non re-usable.
-
fork
ExecRuntime fork(org.apache.hc.core5.concurrent.CancellableDependency cancellableAware)
Forks this runtime for parallel execution.- Returns:
- another runtime with the same configuration.
-
-