Class InternalExecRuntime
java.lang.Object
org.apache.hc.client5.http.impl.classic.InternalExecRuntime
- All Implemented Interfaces:
ExecRuntime
,org.apache.hc.core5.concurrent.Cancellable
class InternalExecRuntime
extends Object
implements ExecRuntime, org.apache.hc.core5.concurrent.Cancellable
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final org.apache.hc.core5.concurrent.CancellableDependency
private final AtomicReference
<ConnectionEndpoint> private final org.slf4j.Logger
private final HttpClientConnectionManager
private final org.apache.hc.core5.http.impl.io.HttpRequestExecutor
private boolean
private Object
private org.apache.hc.core5.util.TimeValue
-
Constructor Summary
ConstructorsConstructorDescriptionInternalExecRuntime
(org.slf4j.Logger log, HttpClientConnectionManager manager, org.apache.hc.core5.http.impl.io.HttpRequestExecutor requestExecutor, org.apache.hc.core5.concurrent.CancellableDependency cancellableDependency) -
Method Summary
Modifier and TypeMethodDescriptionvoid
acquireEndpoint
(String id, HttpRoute route, Object object, HttpClientContext context) Acquires a connection endpoint.boolean
cancel()
private void
connectEndpoint
(ConnectionEndpoint endpoint, HttpClientContext context) 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
Shuts down and discards the acquired endpoint.private void
discardEndpoint
(ConnectionEndpoint endpoint) void
Disconnects the local endpoint from the initial hop in the connection route.(package private) ConnectionEndpoint
org.apache.hc.core5.http.ClassicHttpResponse
execute
(String id, org.apache.hc.core5.http.ClassicHttpRequest request, HttpClientContext context) Executes HTTP request using the given context.fork
(org.apache.hc.core5.concurrent.CancellableDependency cancellableDependency) Forks this runtime for parallel execution.boolean
Determines of the connection is considered re-usable.boolean
Determines of a connection endpoint has been acquired.boolean
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
Determines of the request execution has been aborted.void
Marks the connection as non re-usable.void
markConnectionReusable
(Object state, org.apache.hc.core5.util.TimeValue validDuration) 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
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.
-
Field Details
-
log
private final org.slf4j.Logger log -
manager
-
requestExecutor
private final org.apache.hc.core5.http.impl.io.HttpRequestExecutor requestExecutor -
cancellableDependency
private final org.apache.hc.core5.concurrent.CancellableDependency cancellableDependency -
endpointRef
-
reusable
private volatile boolean reusable -
state
-
validDuration
private volatile org.apache.hc.core5.util.TimeValue validDuration
-
-
Constructor Details
-
InternalExecRuntime
InternalExecRuntime(org.slf4j.Logger log, HttpClientConnectionManager manager, org.apache.hc.core5.http.impl.io.HttpRequestExecutor requestExecutor, org.apache.hc.core5.concurrent.CancellableDependency cancellableDependency)
-
-
Method Details
-
isExecutionAborted
public boolean isExecutionAborted()Description copied from interface:ExecRuntime
Determines of the request execution has been aborted.- Specified by:
isExecutionAborted
in interfaceExecRuntime
- Returns:
true
if the request execution has been acquired,false
otherwise.
-
isEndpointAcquired
public boolean isEndpointAcquired()Description copied from interface:ExecRuntime
Determines of a connection endpoint has been acquired.- Specified by:
isEndpointAcquired
in interfaceExecRuntime
- Returns:
true
if an endpoint has been acquired,false
otherwise.
-
acquireEndpoint
public void acquireEndpoint(String id, HttpRoute route, Object object, HttpClientContext context) throws IOException Description copied from interface:ExecRuntime
Acquires a connection endpoint. Endpoints can leased from a pool or unconnected new endpoint can be created.- Specified by:
acquireEndpoint
in interfaceExecRuntime
- Parameters:
id
- unique operation ID ornull
.route
- the connection route.object
- the expected connection state. May benull
if connection can be state-less or its state is irrelevant.context
- the execution context.- Throws:
IOException
-
ensureValid
ConnectionEndpoint ensureValid() -
isEndpointConnected
public boolean isEndpointConnected()Description copied from interface:ExecRuntime
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).- Specified by:
isEndpointConnected
in interfaceExecRuntime
- Returns:
true
if the endpoint is connected,false
otherwise.
-
connectEndpoint
private void connectEndpoint(ConnectionEndpoint endpoint, HttpClientContext context) throws IOException - Throws:
IOException
-
connectEndpoint
Description copied from interface:ExecRuntime
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).- Specified by:
connectEndpoint
in interfaceExecRuntime
- Parameters:
context
- the execution context.- Throws:
IOException
-
disconnectEndpoint
Description copied from interface:ExecRuntime
Disconnects the local endpoint from the initial hop in the connection route.- Specified by:
disconnectEndpoint
in interfaceExecRuntime
- Throws:
IOException
-
upgradeTls
Description copied from interface:ExecRuntime
Upgrades transport security of the active connection by using the TLS security protocol.- Specified by:
upgradeTls
in interfaceExecRuntime
- Parameters:
context
- the execution context.- Throws:
IOException
-
execute
public org.apache.hc.core5.http.ClassicHttpResponse execute(String id, org.apache.hc.core5.http.ClassicHttpRequest request, HttpClientContext context) throws IOException, org.apache.hc.core5.http.HttpException Description copied from interface:ExecRuntime
Executes HTTP request using the given context.- Specified by:
execute
in interfaceExecRuntime
- Parameters:
id
- unique operation ID ornull
.request
- the request message.context
- the execution context.- Throws:
IOException
org.apache.hc.core5.http.HttpException
-
isConnectionReusable
public boolean isConnectionReusable()Description copied from interface:ExecRuntime
Determines of the connection is considered re-usable.- Specified by:
isConnectionReusable
in interfaceExecRuntime
- Returns:
true
if the connection is re-usable,false
otherwise.
-
markConnectionReusable
Description copied from interface:ExecRuntime
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.- Specified by:
markConnectionReusable
in interfaceExecRuntime
- Parameters:
state
- the connection state representation ornull
if stateless.validDuration
- the period of time this connection is valid for.
-
markConnectionNonReusable
public void markConnectionNonReusable()Description copied from interface:ExecRuntime
Marks the connection as non re-usable.- Specified by:
markConnectionNonReusable
in interfaceExecRuntime
-
discardEndpoint
-
releaseEndpoint
public void releaseEndpoint()Description copied from interface:ExecRuntime
Releases the acquired endpoint potentially making it available for re-use.- Specified by:
releaseEndpoint
in interfaceExecRuntime
-
discardEndpoint
public void discardEndpoint()Description copied from interface:ExecRuntime
Shuts down and discards the acquired endpoint.- Specified by:
discardEndpoint
in interfaceExecRuntime
-
cancel
public boolean cancel()- Specified by:
cancel
in interfaceorg.apache.hc.core5.concurrent.Cancellable
-
fork
Description copied from interface:ExecRuntime
Forks this runtime for parallel execution.- Specified by:
fork
in interfaceExecRuntime
- Returns:
- another runtime with the same configuration.
-