|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.commons.httpclient.MultiThreadedHttpConnectionManager
public class MultiThreadedHttpConnectionManager
Manages a set of HttpConnections for various HostConfigurations.
Field Summary | |
---|---|
static int |
DEFAULT_MAX_HOST_CONNECTIONS
The default maximum number of connections allowed per host |
static int |
DEFAULT_MAX_TOTAL_CONNECTIONS
The default maximum number of connections allowed overall |
Constructor Summary | |
---|---|
MultiThreadedHttpConnectionManager()
No-args constructor |
Method Summary | |
---|---|
void |
closeIdleConnections(long idleTimeout)
Closes connections that have been idle for at least the given amount of time. |
void |
deleteClosedConnections()
Deletes all closed connections. |
HttpConnection |
getConnection(HostConfiguration hostConfiguration)
Gets an HttpConnection for a given host configuration. |
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. |
HttpConnection |
getConnectionWithTimeout(HostConfiguration hostConfiguration,
long timeout)
Gets an HttpConnection for a given host configuration. |
HttpConnectionManagerParams |
getParams()
Returns parameters associated
with this connection manager. |
void |
releaseConnection(HttpConnection conn)
Make the given HttpConnection available for use by other requests. |
void |
setParams(HttpConnectionManagerParams 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 MultiThreadedHttpConnectionManager. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_MAX_HOST_CONNECTIONS
public static final int DEFAULT_MAX_TOTAL_CONNECTIONS
Constructor Detail |
---|
public MultiThreadedHttpConnectionManager()
Method Detail |
---|
public static void shutdownAll()
shutdown()
is called on all live instances of
MultiThreadedHttpConnectionManager.
shutdown()
public void shutdown()
The connection manager can no longer be used once shutdown.
Calling this method more than once will have no effect.
public HttpConnection getConnection(HostConfiguration hostConfiguration)
HttpConnectionManager
getConnection
in interface HttpConnectionManager
hostConfiguration
- the host configuration to use to configure the
connection
HttpConnectionManager.getConnection(HostConfiguration)
public HttpConnection getConnectionWithTimeout(HostConfiguration hostConfiguration, long timeout) throws ConnectionPoolTimeoutException
HttpConnectionManager
getConnectionWithTimeout
in interface HttpConnectionManager
hostConfiguration
- the host configuration to use to configure the
connectiontimeout
- - the time (in milliseconds) to wait for a connection to
become available, 0 to specify an infinite timeout
ConnectionPoolTimeoutException
- if no connection becomes available before the
timeout expiresHttpConnectionManager.getConnectionWithTimeout(HostConfiguration, long)
public int getConnectionsInPool(HostConfiguration hostConfiguration)
hostConfiguration
- The host configuration
public int getConnectionsInPool()
public void deleteClosedConnections()
HttpConnection.isOpen()
public void closeIdleConnections(long idleTimeout)
HttpConnectionManager
closeIdleConnections
in interface HttpConnectionManager
idleTimeout
- public void releaseConnection(HttpConnection conn)
releaseConnection
in interface HttpConnectionManager
conn
- the HttpConnection to make available.public HttpConnectionManagerParams getParams()
parameters
associated
with this connection manager.
getParams
in interface HttpConnectionManager
HttpConnectionManagerParams
public void setParams(HttpConnectionManagerParams params)
parameters
for this
connection manager.
setParams
in interface HttpConnectionManager
params
- params to setHttpConnectionManagerParams
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |