This connection manager will make an effort to reuse the connection for subsequent requests
with the same route. It will, however, close the existing connection and
open it for the given route, if the route of the persistent connection does not match that
of the connection request. If the connection has been already been allocated
IllegalStateException is thrown.
This connection manager implementation should be used inside an EJB container instead of
PoolingHttpClientConnectionManager.
| Modifier and Type | Class and Description |
|---|---|
| pack-priv class |
| Modifier and Type | Field and Description |
|---|---|
| private final AtomicBoolean | |
| private ManagedHttpClientConnection | |
| private ConnectionConfig | |
| private final HttpClientConnectionOperator | |
| private final HttpConnectionFactory | |
| private static final AtomicLong | |
| private long | |
| private long | |
| private final String | |
| private boolean | |
| private static final Logger | |
| private HttpRoute | |
| private SocketConfig | |
| private Object | |
| private TlsConfig | |
| private long |
| Access | Constructor and Description |
|---|---|
| public | BasicHttpClientConnectionManager(final Lookup<ConnectionSocketFactory> socketFactoryRegistry, final HttpConnectionFactory<ManagedHttpClientConnection> connFactory, final SchemePortResolver schemePortResolver, final DnsResolver dnsResolver)
|
| public | BasicHttpClientConnectionManager(final HttpClientConnectionOperator httpClientConnectionOperator, final HttpConnectionFactory<ManagedHttpClientConnection> connFactory)
|
| public | BasicHttpClientConnectionManager(final Lookup<ConnectionSocketFactory> socketFactoryRegistry, final HttpConnectionFactory<ManagedHttpClientConnection> connFactory)
|
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| private BasicHttpClientConnectionManager. | |
| private void | |
| public void | close()
Implements java. |
| public void | close(final CloseMode
How to close the receiver. closeMode)Implements org. |
| private synchronized void | |
| public synchronized void | |
| public synchronized void | |
| public synchronized void | connect(final ConnectionEndpoint
the managed endpoint. endpoint, final TimeValue connect timeout. timeout, final HttpContext the actual HTTP context. context)Implements org. |
| pack-priv synchronized ManagedHttpClientConnection | |
| public synchronized ConnectionConfig | |
| private static Registry | |
| pack-priv HttpRoute | |
| public synchronized SocketConfig | |
| pack-priv Object | |
| public synchronized TlsConfig | |
| public TimeValue | |
| pack-priv boolean | Returns: true if the connection manager has been shut down and is closed, otherwise
return false.Method that can be called to determine whether the connection manager has been shut down and is closed or not. |
| public LeaseRequest | |
| public LeaseRequest | lease(final String
unique operation ID or id, final HttpRoute null.HTTP route of the requested connection. route, final Timeout lease request timeout. requestTimeout, final Object expected state of the connection or state)null
if the connection is not expected to carry any state.Implements org. LeaseRequest object which can be used to obtain
a ConnectionEndpoint to cancel the request by calling
LeaseRequest#cancel().
|
| public synchronized void | release(final ConnectionEndpoint
the managed endpoint. endpoint, final Object the new connection state of state, final TimeValue null if state-less.the duration of time this connection is valid for reuse. keepAlive)Implements org. |
| public synchronized void | |
| public synchronized void | |
| public synchronized void | |
| public void | setValidateAfterInactivity(final TimeValue validateAfterInactivity)
Deprecated
Use
Defines period of inactivity after which persistent connections must
be re-validated prior to being setConnectionConfig(ConnectionConfig)
lease(String, HttpRoute, Object) leased} to the consumer.
|
| public synchronized void | upgrade(final ConnectionEndpoint
the managed endpoint. endpoint, final HttpContext the actual HTTP context. context)Implements org. |
| private void |
| closed | back to summary |
|---|---|
| private final AtomicBoolean closed | |
| conn | back to summary |
|---|---|
| private ManagedHttpClientConnection conn | |
| connectionConfig | back to summary |
|---|---|
| private ConnectionConfig connectionConfig | |
| connectionOperator | back to summary |
|---|---|
| private final HttpClientConnectionOperator connectionOperator | |
| connFactory | back to summary |
|---|---|
| private final HttpConnectionFactory<ManagedHttpClientConnection> connFactory | |
| COUNT | back to summary |
|---|---|
| private static final AtomicLong COUNT | |
| created | back to summary |
|---|---|
| private long created | |
| expiry | back to summary |
|---|---|
| private long expiry | |
| id | back to summary |
|---|---|
| private final String id | |
| leased | back to summary |
|---|---|
| private boolean leased | |
| LOG | back to summary |
|---|---|
| private static final Logger LOG | |
| route | back to summary |
|---|---|
| private HttpRoute route | |
| socketConfig | back to summary |
|---|---|
| private SocketConfig socketConfig | |
| state | back to summary |
|---|---|
| private Object state | |
| tlsConfig | back to summary |
|---|---|
| private TlsConfig tlsConfig | |
| updated | back to summary |
|---|---|
| private long updated | |
| BasicHttpClientConnectionManager | back to summary |
|---|---|
| public BasicHttpClientConnectionManager(final Lookup<ConnectionSocketFactory> socketFactoryRegistry, final HttpConnectionFactory<ManagedHttpClientConnection> connFactory, final SchemePortResolver schemePortResolver, final DnsResolver dnsResolver) | |
| BasicHttpClientConnectionManager | back to summary |
|---|---|
public BasicHttpClientConnectionManager(final HttpClientConnectionOperator httpClientConnectionOperator, final HttpConnectionFactory<ManagedHttpClientConnection> connFactory)
| |
| BasicHttpClientConnectionManager | back to summary |
|---|---|
| public BasicHttpClientConnectionManager(final Lookup<ConnectionSocketFactory> socketFactoryRegistry, final HttpConnectionFactory<ManagedHttpClientConnection> connFactory) | |
| BasicHttpClientConnectionManager | back to summary |
|---|---|
| public BasicHttpClientConnectionManager(final Lookup<ConnectionSocketFactory> socketFactoryRegistry) | |
| BasicHttpClientConnectionManager | back to summary |
|---|---|
| public BasicHttpClientConnectionManager() | |
| cast | back to summary |
|---|---|
| private BasicHttpClientConnectionManager. | |
| checkExpiry | back to summary |
|---|---|
| private void checkExpiry() | |
| close | back to summary |
|---|---|
| public void close() Implements java. Doc from java. Closes this stream and releases any system resources associated with it. If the stream is already closed then invoking this method has no effect. As noted in
| |
| close | back to summary |
|---|---|
| public void close(final CloseMode closeMode) Implements org. Doc from org. Closes this process or endpoint and releases any system resources associated with it. If the endpoint or the process is already closed then invoking this method has no effect. | |
| closeConnection | back to summary |
|---|---|
| private synchronized void closeConnection(final CloseMode closeMode) | |
| closeExpired | back to summary |
|---|---|
| public synchronized void closeExpired() | |
| closeIdle | back to summary |
|---|---|
| public synchronized void closeIdle(final TimeValue idleTime) | |
| connect | back to summary |
|---|---|
| public synchronized void connect(final ConnectionEndpoint endpoint, final TimeValue timeout, final HttpContext context) throws IOException Implements org. Doc from org. Connects the 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).
| |
| getConnection | back to summary |
|---|---|
| pack-priv synchronized ManagedHttpClientConnection getConnection(final HttpRoute route, final Object state) throws IOException | |
| getConnectionConfig | back to summary |
|---|---|
public synchronized ConnectionConfig getConnectionConfig()
| |
| getDefaultRegistry | back to summary |
|---|---|
| private static Registry | |
| getRoute | back to summary |
|---|---|
| pack-priv HttpRoute getRoute() | |
| getSocketConfig | back to summary |
|---|---|
| public synchronized SocketConfig getSocketConfig() | |
| getState | back to summary |
|---|---|
| pack-priv Object getState() | |
| getTlsConfig | back to summary |
|---|---|
public synchronized TlsConfig getTlsConfig()
| |
| getValidateAfterInactivity | back to summary |
|---|---|
| public TimeValue getValidateAfterInactivity()
Deprecated
| |
| isClosed | back to summary |
|---|---|
| pack-priv boolean isClosed() Method that can be called to determine whether the connection manager has been shut down and is closed or not.
| |
| lease | back to summary |
|---|---|
| public LeaseRequest lease(final String id, final HttpRoute route, final Object state) | |
| lease | back to summary |
|---|---|
| public LeaseRequest lease(final String id, final HttpRoute route, final Timeout requestTimeout, final Object state) Implements org. Doc from org. Returns a
Please note that newly allocated endpoints can be leased
| |
| release | back to summary |
|---|---|
| public synchronized void release(final ConnectionEndpoint endpoint, final Object state, final TimeValue keepAlive) Implements org. Doc from org. Releases the endpoint back to the manager making it potentially
re-usable by other consumers. Optionally, the maximum period
of how long the manager should keep the connection alive can be
defined using
| |
| setConnectionConfig | back to summary |
|---|---|
public synchronized void setConnectionConfig(final ConnectionConfig connectionConfig)
| |
| setSocketConfig | back to summary |
|---|---|
| public synchronized void setSocketConfig(final SocketConfig socketConfig) | |
| setTlsConfig | back to summary |
|---|---|
public synchronized void setTlsConfig(final TlsConfig tlsConfig)
| |
| setValidateAfterInactivity | back to summary |
|---|---|
| public void setValidateAfterInactivity(final TimeValue validateAfterInactivity)
Deprecated Defines period of inactivity after which persistent connections must
be re-validated prior to being
| |
| upgrade | back to summary |
|---|---|
| public synchronized void upgrade(final ConnectionEndpoint endpoint, final HttpContext context) throws IOException Implements org. Doc from org. Upgrades transport security of the given endpoint by using the TLS security protocol.
| |
| validate | back to summary |
|---|---|
| private void validate() | |
| Modifier and Type | Field and Description |
|---|---|
| private final AtomicReference | |
| private final HttpRoute |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | close(final CloseMode
How to close the receiver. closeMode)Implements org. |
| public void | close()
Implements java. |
| pack-priv ManagedHttpClientConnection | |
| public ClassicHttpResponse | execute(final String
unique operation ID or exchangeId, final ClassicHttpRequest null.the request message. request, final HttpRequestExecutor the request executor. requestExecutor, final HttpContext the execution context. context)Implements abstract org. |
| pack-priv ManagedHttpClientConnection | |
| pack-priv HttpRoute | |
| pack-priv ManagedHttpClientConnection | |
| public boolean | isConnected()
Implements abstract org. |
| public void | setSocketTimeout(final Timeout
timeout value timeout)Implements abstract org. |
| connRef | back to summary |
|---|---|
| private final AtomicReference<ManagedHttpClientConnection> connRef | |
| route | back to summary |
|---|---|
| private final HttpRoute route | |
| InternalConnectionEndpoint | back to summary |
|---|---|
| public InternalConnectionEndpoint(final HttpRoute route, final ManagedHttpClientConnection conn) | |
| close | back to summary |
|---|---|
| public void close(final CloseMode closeMode) Implements org. Doc from org. Closes this process or endpoint and releases any system resources associated with it. If the endpoint or the process is already closed then invoking this method has no effect. | |
| close | back to summary |
|---|---|
| public void close() throws IOException Implements java. Doc from java. Closes this stream and releases any system resources associated with it. If the stream is already closed then invoking this method has no effect. As noted in
| |
| detach | back to summary |
|---|---|
| pack-priv ManagedHttpClientConnection detach() | |
| execute | back to summary |
|---|---|
| public ClassicHttpResponse execute(final String exchangeId, final ClassicHttpRequest request, final HttpRequestExecutor requestExecutor, final HttpContext context) throws IOException, HttpException Implements abstract org. Doc from org. Executes HTTP request using the provided request executor.
Once the endpoint is no longer needed it MUST be released with
| |
| getConnection | back to summary |
|---|---|
| pack-priv ManagedHttpClientConnection getConnection() | |
| getRoute | back to summary |
|---|---|
| pack-priv HttpRoute getRoute() | |
| getValidatedConnection | back to summary |
|---|---|
| pack-priv ManagedHttpClientConnection getValidatedConnection() | |
| isConnected | back to summary |
|---|---|
| public boolean isConnected() Implements abstract org. Doc from org. Determines if the connection to the remote endpoint is still open and valid.
| |
| setSocketTimeout | back to summary |
|---|---|
| public void setSocketTimeout(final Timeout timeout) Implements abstract org. Doc from org. Sets the socket timeout value. | |