|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.http.impl.conn.ThreadSafeClientConnManager
public class ThreadSafeClientConnManager
Manages a pool of client connections
.
This class is derived from MultiThreadedHttpConnectionManager
in HttpClient 3. See there for original authors.
Field Summary | |
---|---|
protected SchemeRegistry |
schemeRegistry
The schemes supported by this connection manager. |
Constructor Summary | |
---|---|
ThreadSafeClientConnManager(org.apache.http.params.HttpParams params,
SchemeRegistry schreg)
Creates a new thread safe connection manager. |
Method Summary | |
---|---|
void |
closeIdleConnections(long idleTimeout)
Deletes all free connections that are idle or closed. |
protected ClientConnectionOperator |
createConnectionOperator(SchemeRegistry schreg)
Hook for creating the connection operator. |
ManagedClientConnection |
getConnection(HttpRoute route)
Obtains a connection. |
ManagedClientConnection |
getConnection(HttpRoute route,
long timeout)
Obtains a connection within a given time. |
int |
getConnectionsInPool()
Gets the total number of pooled connections. |
int |
getConnectionsInPool(HostConfiguration hostConfiguration)
Gets the total number of pooled connections for the given host configuration. |
org.apache.http.params.HttpParams |
getParams()
Returns parameters associated
with this connection manager. |
SchemeRegistry |
getSchemeRegistry()
|
void |
releaseConnection(ManagedClientConnection conn)
Releases an allocated connection. |
void |
setParams(org.apache.http.params.HttpParams params)
Assigns parameters for this
connection manager. |
void |
shutdown()
Shuts down the connection manager and releases all resources. |
static void |
shutdownAll()
Shuts down and cleans up resources used by all instances of ThreadSafeClientConnManager. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected SchemeRegistry schemeRegistry
Constructor Detail |
---|
public ThreadSafeClientConnManager(org.apache.http.params.HttpParams params, SchemeRegistry schreg)
params
- the parameters for this managerschreg
- the scheme registry, or
null
for the default registryMethod Detail |
---|
public SchemeRegistry getSchemeRegistry()
getSchemeRegistry
in interface ClientConnectionManager
public ManagedClientConnection getConnection(HttpRoute route)
ClientConnectionManager
shut down
.
getConnection
in interface ClientConnectionManager
route
- where the connection should point to
public ManagedClientConnection getConnection(HttpRoute route, long timeout) throws ConnectionPoolTimeoutException
ClientConnectionManager
shut down
.
getConnection
in interface ClientConnectionManager
route
- where the connection should point totimeout
- the timeout in milliseconds
ConnectionPoolTimeoutException
- in case of a timeoutprotected ClientConnectionOperator createConnectionOperator(SchemeRegistry schreg)
DefaultClientConnectionOperator
.
schreg
- the scheme registry to use, or null
public void releaseConnection(ManagedClientConnection conn)
releaseConnection
in interface ClientConnectionManager
conn
- the connection to make available.public static void shutdownAll()
shutdown()
is called on all live instances of
ThreadSafeClientConnManager.
shutdown()
public void shutdown()
The connection manager can no longer be used once shutdown.
Calling this method more than once will have no effect.
shutdown
in interface ClientConnectionManager
public int getConnectionsInPool(HostConfiguration hostConfiguration)
hostConfiguration
- The host configuration
public int getConnectionsInPool()
public void closeIdleConnections(long idleTimeout)
closeIdleConnections
in interface ClientConnectionManager
idleTimeout
- the idle time in millisecondspublic org.apache.http.params.HttpParams getParams()
parameters
associated
with this connection manager.
public void setParams(org.apache.http.params.HttpParams params)
parameters
for this
connection manager.
HttpConnectionManagerParams
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |