|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.http.impl.conn.BasicClientConnectionManager
@ThreadSafe public class BasicClientConnectionManager
A connection manager for a single connection. This connection manager maintains only one active connection at a time. Even though this class is thread-safe it ought to be used by one execution thread only.
BasicClientConnManager 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 can be used inside a EJB container instead of
PoolingClientConnectionManager
.
Field Summary | |
---|---|
static String |
MISUSE_MESSAGE
The message to be logged on multiple allocation. |
Constructor Summary | |
---|---|
BasicClientConnectionManager()
|
|
BasicClientConnectionManager(SchemeRegistry schreg)
Creates a new simple connection manager. |
Method Summary | |
---|---|
void |
closeExpiredConnections()
Closes all expired connections in the pool. |
void |
closeIdleConnections(long idletime,
TimeUnit tunit)
Closes idle connections in the pool. |
protected ClientConnectionOperator |
createConnectionOperator(SchemeRegistry schreg)
|
protected void |
finalize()
|
SchemeRegistry |
getSchemeRegistry()
Obtains the scheme registry used by this manager. |
void |
releaseConnection(ManagedClientConnection conn,
long keepalive,
TimeUnit tunit)
Releases a connection for use by others. |
ClientConnectionRequest |
requestConnection(HttpRoute route,
Object state)
Returns a new ClientConnectionRequest , from which a
ManagedClientConnection can be obtained or the request can be
aborted. |
void |
shutdown()
Shuts down this connection manager and releases allocated resources. |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String MISUSE_MESSAGE
Constructor Detail |
---|
public BasicClientConnectionManager(SchemeRegistry schreg)
schreg
- the scheme registrypublic BasicClientConnectionManager()
Method Detail |
---|
protected void finalize() throws Throwable
finalize
in class Object
Throwable
public SchemeRegistry getSchemeRegistry()
ClientConnectionManager
getSchemeRegistry
in interface ClientConnectionManager
null
protected ClientConnectionOperator createConnectionOperator(SchemeRegistry schreg)
public final ClientConnectionRequest requestConnection(HttpRoute route, Object state)
ClientConnectionManager
ClientConnectionRequest
, from which a
ManagedClientConnection
can be obtained or the request can be
aborted.
requestConnection
in interface ClientConnectionManager
public void releaseConnection(ManagedClientConnection conn, long keepalive, TimeUnit tunit)
ClientConnectionManager
releaseConnection
in interface ClientConnectionManager
conn
- the connection to releasekeepalive
- the duration of time this connection is valid for reusetunit
- the unit of time validDuration is measured inClientConnectionManager.closeExpiredConnections()
public void closeExpiredConnections()
ClientConnectionManager
closeExpiredConnections
in interface ClientConnectionManager
public void closeIdleConnections(long idletime, TimeUnit tunit)
ClientConnectionManager
closeIdleConnections
in interface ClientConnectionManager
idletime
- the idle time of connections to be closedtunit
- the unit for the idletime
ClientConnectionManager.closeExpiredConnections()
public void shutdown()
ClientConnectionManager
shutdown
in interface ClientConnectionManager
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |