|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.http.impl.conn.BasicHttpClientConnectionManager
@ThreadSafe public class BasicHttpClientConnectionManager
A connection manager for a single connection. This connection manager maintains only one active connection. Even though this class is fully thread-safe it ought to be used by one execution thread only, as only one thread a time can lease the connection at a time.
This connection manager will make an effort to reuse the connection for subsequent requests with the sameroute
. 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 Summary | |
---|---|
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)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
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()
Method Detail |
---|
protected void finalize() throws Throwable
finalize
in class Object
Throwable
public void close()
close
in interface Closeable
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
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |