|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--org.apache.commons.httpclient.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. |
HttpConnection |
getConnection(HostConfiguration hostConfiguration,
long timeout)
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. |
int |
getConnectionsInUse()
Deprecated. Use getConnectionsInPool() |
int |
getConnectionsInUse(HostConfiguration hostConfiguration)
Deprecated. Use getConnectionsInPool(HostConfiguration) |
HttpConnection |
getConnectionWithTimeout(HostConfiguration hostConfiguration,
long timeout)
Gets an HttpConnection for a given host configuration. |
int |
getMaxConnectionsPerHost()
Deprecated. Use HttpConnectionManagerParams.getDefaultMaxConnectionsPerHost(),
HttpConnectionManager.getParams(). |
int |
getMaxTotalConnections()
Deprecated. Use HttpConnectionManagerParams.getMaxTotalConnections(),
HttpConnectionManager.getParams(). |
HttpConnectionManagerParams |
getParams()
Returns parameters associated
with this connection manager. |
boolean |
isConnectionStaleCheckingEnabled()
Deprecated. Use HttpConnectionParams.isStaleCheckingEnabled(),
HttpConnectionManager.getParams(). |
void |
releaseConnection(HttpConnection conn)
Make the given HttpConnection available for use by other requests. |
void |
setConnectionStaleCheckingEnabled(boolean connectionStaleCheckingEnabled)
Deprecated. Use HttpConnectionParams.setStaleCheckingEnabled(boolean),
HttpConnectionManager.getParams(). |
void |
setMaxConnectionsPerHost(int maxHostConnections)
Deprecated. Use HttpConnectionManagerParams.setDefaultMaxConnectionsPerHost(int),
HttpConnectionManager.getParams(). |
void |
setMaxTotalConnections(int maxTotalConnections)
Deprecated. Use HttpConnectionManagerParams.setMaxTotalConnections(int),
HttpConnectionManager.getParams(). |
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 boolean isConnectionStaleCheckingEnabled()
HttpConnectionParams.isStaleCheckingEnabled(),
HttpConnectionManager.getParams().
true if stale checking will be enabled on HttpConnectionsHttpConnection.isStaleCheckingEnabled()public void setConnectionStaleCheckingEnabled(boolean connectionStaleCheckingEnabled)
HttpConnectionParams.setStaleCheckingEnabled(boolean),
HttpConnectionManager.getParams().
connectionStaleCheckingEnabled - true if stale checking will be enabled
on HttpConnectionsHttpConnection.setStaleCheckingEnabled(boolean)public void setMaxConnectionsPerHost(int maxHostConnections)
HttpConnectionManagerParams.setDefaultMaxConnectionsPerHost(int),
HttpConnectionManager.getParams().
maxHostConnections - the number of connections allowed for each
hostConfigurationpublic int getMaxConnectionsPerHost()
HttpConnectionManagerParams.getDefaultMaxConnectionsPerHost(),
HttpConnectionManager.getParams().
public void setMaxTotalConnections(int maxTotalConnections)
HttpConnectionManagerParams.setMaxTotalConnections(int),
HttpConnectionManager.getParams().
maxTotalConnections - the maximum number of connections allowedpublic int getMaxTotalConnections()
HttpConnectionManagerParams.getMaxTotalConnections(),
HttpConnectionManager.getParams().
public HttpConnection getConnection(HostConfiguration hostConfiguration)
HttpConnectionManagergetConnection in interface HttpConnectionManagerHttpConnectionManager.getConnection(HostConfiguration)
public HttpConnection getConnectionWithTimeout(HostConfiguration hostConfiguration,
long timeout)
throws ConnectionPoolTimeoutException
HttpConnectionManagergetConnectionWithTimeout in interface HttpConnectionManagerHttpConnectionManager.getConnectionWithTimeout(HostConfiguration, long)
public HttpConnection getConnection(HostConfiguration hostConfiguration,
long timeout)
throws HttpException
HttpConnectionManagergetConnection in interface HttpConnectionManagerHttpConnectionManager.getConnection(HostConfiguration, long)public int getConnectionsInPool(HostConfiguration hostConfiguration)
maximum number of connections per
host.hostConfiguration - The host configurationpublic int getConnectionsInPool()
maximum number of connections.public int getConnectionsInUse(HostConfiguration hostConfiguration)
getConnectionsInPool(HostConfiguration)
hostConfiguration - the key that connections are tracked onpublic int getConnectionsInUse()
getConnectionsInPool()
public void deleteClosedConnections()
HttpConnection.isOpen()public void closeIdleConnections(long idleTimeout)
HttpConnectionManagercloseIdleConnections in interface HttpConnectionManagerpublic void releaseConnection(HttpConnection conn)
releaseConnection in interface HttpConnectionManagerconn - the HttpConnection to make available.public HttpConnectionManagerParams getParams()
parameters associated
with this connection manager.getParams in interface HttpConnectionManagerHttpConnectionManagerParamspublic void setParams(HttpConnectionManagerParams params)
parameters for this
connection manager.setParams in interface HttpConnectionManagerHttpConnectionManagerParams
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||