@ThreadSafe public class BasicHttpClientConnectionManager extends Object implements HttpClientConnectionManager, Closeable
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
.Constructor and Description |
---|
BasicHttpClientConnectionManager() |
BasicHttpClientConnectionManager(org.apache.http.config.Lookup<ConnectionSocketFactory> socketFactoryRegistry) |
BasicHttpClientConnectionManager(org.apache.http.config.Lookup<ConnectionSocketFactory> socketFactoryRegistry,
HttpConnectionFactory<ManagedHttpClientConnection> connFactory) |
BasicHttpClientConnectionManager(org.apache.http.config.Lookup<ConnectionSocketFactory> socketFactoryRegistry,
HttpConnectionFactory<ManagedHttpClientConnection> connFactory,
SchemePortResolver schemePortResolver,
DnsResolver dnsResolver) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
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) |
protected void |
finalize() |
org.apache.http.config.ConnectionConfig |
getConnectionConfig() |
org.apache.http.config.SocketConfig |
getSocketConfig() |
void |
releaseConnection(HttpClientConnection conn,
Object state,
long keepalive,
TimeUnit tunit)
Releases a connection for use by others.
|
ConnectionRequest |
requestConnection(HttpRoute route,
Object state)
Returns a new
ClientConnectionRequest , from which a
HttpClientConnection can be obtained or the request can be
aborted. |
void |
routeComplete(HttpClientConnection conn,
HttpRoute route,
HttpContext context) |
void |
setConnectionConfig(org.apache.http.config.ConnectionConfig connConfig) |
void |
setSocketConfig(org.apache.http.config.SocketConfig socketConfig) |
void |
shutdown()
Shuts down this connection manager and releases allocated resources.
|
void |
upgrade(HttpClientConnection conn,
HttpRoute route,
HttpContext context) |
public BasicHttpClientConnectionManager(org.apache.http.config.Lookup<ConnectionSocketFactory> socketFactoryRegistry, HttpConnectionFactory<ManagedHttpClientConnection> connFactory, SchemePortResolver schemePortResolver, DnsResolver dnsResolver)
public BasicHttpClientConnectionManager(org.apache.http.config.Lookup<ConnectionSocketFactory> socketFactoryRegistry, HttpConnectionFactory<ManagedHttpClientConnection> connFactory)
public BasicHttpClientConnectionManager(org.apache.http.config.Lookup<ConnectionSocketFactory> socketFactoryRegistry)
public BasicHttpClientConnectionManager()
protected void finalize() throws Throwable
public void close()
close
in interface Closeable
close
in interface AutoCloseable
public org.apache.http.config.SocketConfig getSocketConfig()
public void setSocketConfig(org.apache.http.config.SocketConfig socketConfig)
public org.apache.http.config.ConnectionConfig getConnectionConfig()
public void setConnectionConfig(org.apache.http.config.ConnectionConfig connConfig)
public final ConnectionRequest requestConnection(HttpRoute route, Object state)
HttpClientConnectionManager
ClientConnectionRequest
, from which a
HttpClientConnection
can be obtained or the request can be
aborted.requestConnection
in interface HttpClientConnectionManager
public void releaseConnection(HttpClientConnection conn, Object state, long keepalive, TimeUnit tunit)
HttpClientConnectionManager
releaseConnection
in interface HttpClientConnectionManager
conn
- the connection to releasekeepalive
- the duration of time this connection is valid for reusetunit
- the unit of time validDuration is measured inHttpClientConnectionManager.closeExpiredConnections()
public void connect(HttpClientConnection conn, HttpRoute route, int connectTimeout, HttpContext context) throws IOException
connect
in interface HttpClientConnectionManager
IOException
public void upgrade(HttpClientConnection conn, HttpRoute route, HttpContext context) throws IOException
upgrade
in interface HttpClientConnectionManager
IOException
public void routeComplete(HttpClientConnection conn, HttpRoute route, HttpContext context) throws IOException
routeComplete
in interface HttpClientConnectionManager
IOException
public void closeExpiredConnections()
HttpClientConnectionManager
closeExpiredConnections
in interface HttpClientConnectionManager
public void closeIdleConnections(long idletime, TimeUnit tunit)
HttpClientConnectionManager
closeIdleConnections
in interface HttpClientConnectionManager
idletime
- the idle time of connections to be closedtunit
- the unit for the idletime
HttpClientConnectionManager.closeExpiredConnections()
public void shutdown()
HttpClientConnectionManager
shutdown
in interface HttpClientConnectionManager
Copyright © 1999-2013 The Apache Software Foundation. All Rights Reserved.