@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 Closeableclose in interface AutoCloseablepublic 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)
HttpClientConnectionManagerClientConnectionRequest, from which a
HttpClientConnection can be obtained or the request can be
aborted.requestConnection in interface HttpClientConnectionManagerpublic void releaseConnection(HttpClientConnection conn, Object state, long keepalive, TimeUnit tunit)
HttpClientConnectionManagerreleaseConnection in interface HttpClientConnectionManagerconn - 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 HttpClientConnectionManagerIOExceptionpublic void upgrade(HttpClientConnection conn, HttpRoute route, HttpContext context) throws IOException
upgrade in interface HttpClientConnectionManagerIOExceptionpublic void routeComplete(HttpClientConnection conn, HttpRoute route, HttpContext context) throws IOException
routeComplete in interface HttpClientConnectionManagerIOExceptionpublic void closeExpiredConnections()
HttpClientConnectionManagercloseExpiredConnections in interface HttpClientConnectionManagerpublic void closeIdleConnections(long idletime,
TimeUnit tunit)
HttpClientConnectionManagercloseIdleConnections in interface HttpClientConnectionManageridletime - the idle time of connections to be closedtunit - the unit for the idletimeHttpClientConnectionManager.closeExpiredConnections()public void shutdown()
HttpClientConnectionManagershutdown in interface HttpClientConnectionManagerCopyright © 1999-2013 The Apache Software Foundation. All Rights Reserved.