public interface HttpClientConnectionManager
Modifier and Type | Method and Description |
---|---|
void |
closeExpiredConnections()
Closes all expired connections in the pool.
|
void |
closeIdleConnections(long idletime,
TimeUnit tunit)
Closes idle connections in the pool.
|
void |
connect(HttpClientConnection conn,
HttpRoute route,
int connectTimeout,
HttpContext context)
Connects the underlying connection socket to the 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 |
releaseConnection(HttpClientConnection conn,
Object newState,
long validDuration,
TimeUnit timeUnit)
Releases the connection back to the manager making it potentially
re-usable by other consumers.
|
ConnectionRequest |
requestConnection(HttpRoute route,
Object state)
Returns a new
ConnectionRequest , from which a
HttpClientConnection can be obtained or the request can be
aborted. |
void |
routeComplete(HttpClientConnection conn,
HttpRoute route,
HttpContext context)
Marks the connection as fully established with all its intermediate
hops completed.
|
void |
shutdown()
Shuts down this connection manager and releases allocated resources.
|
void |
upgrade(HttpClientConnection conn,
HttpRoute route,
HttpContext context)
Upgrades the underlying connection socket to TLS/SSL (or another layering
protocol) after having executed
CONNECT method to all
intermediate proxy hops |
ConnectionRequest requestConnection(HttpRoute route, Object state)
ConnectionRequest
, from which a
HttpClientConnection
can be obtained or the request can be
aborted.
Please note that newly allocated connections can be returned
in the closed state. The consumer of that connection is responsible
for fully establishing the route the to the connection target
by calling connect
in order to connect
directly to the target or to the first proxy hop, optionally calling
upgrade
method to upgrade
the connection after having executed CONNECT
method to
all intermediate proxy hops and and finally calling routeComplete
to mark the route
as fully completed.route
- HTTP route of the requested connection.state
- expected state of the connection or null
if the connection is not expected to carry any state.void releaseConnection(HttpClientConnection conn, Object newState, long validDuration, TimeUnit timeUnit)
validDuration
and timeUnit
parameters.conn
- the managed connection to release.validDuration
- the duration of time this connection is valid for reuse.timeUnit
- the time unit.closeExpiredConnections()
void connect(HttpClientConnection conn, HttpRoute route, int connectTimeout, HttpContext context) throws IOException
conn
- the managed connection.route
- the route of the connection.connectTimeout
- connect timeout in milliseconds.context
- the actual HTTP context.IOException
void upgrade(HttpClientConnection conn, HttpRoute route, HttpContext context) throws IOException
CONNECT
method to all
intermediate proxy hopsconn
- the managed connection.route
- the route of the connection.context
- the actual HTTP context.IOException
void routeComplete(HttpClientConnection conn, HttpRoute route, HttpContext context) throws IOException
conn
- the managed connection.route
- the route of the connection.context
- the actual HTTP context.IOException
void closeIdleConnections(long idletime, TimeUnit tunit)
idletime
- the idle time of connections to be closedtunit
- the unit for the idletime
closeExpiredConnections()
void closeExpiredConnections()
void shutdown()
Copyright © 1999–2013 The Apache Software Foundation. All rights reserved.