|
||||||||||
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 | |
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 |
getConnectionsInUse()
Gets the total number of connections in use. |
int |
getConnectionsInUse(HostConfiguration hostConfiguration)
Gets the number of connections in use for this configuration. |
int |
getMaxConnectionsPerHost()
Gets the maximum number of connections allowed for a given hostConfiguration. |
int |
getMaxTotalConnections()
Gets the maximum number of connections allowed in the system. |
boolean |
isConnectionStaleCheckingEnabled()
Gets the staleCheckingEnabled value to be set on HttpConnections that are created. |
void |
releaseConnection(HttpConnection conn)
Make the given HttpConnection available for use by other requests. |
void |
setConnectionStaleCheckingEnabled(boolean connectionStaleCheckingEnabled)
Sets the staleCheckingEnabled value to be set on HttpConnections that are created. |
void |
setMaxConnectionsPerHost(int maxHostConnections)
Sets the maximum number of connections allowed for a given HostConfiguration. |
void |
setMaxTotalConnections(int maxTotalConnections)
Sets the maximum number of connections allowed in the system. |
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 |
|
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 instaces 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()
true
if stale checking will be enabled on HttpConectionsHttpConnection.isStaleCheckingEnabled()
public void setConnectionStaleCheckingEnabled(boolean connectionStaleCheckingEnabled)
connectionStaleCheckingEnabled
- true
if stale checking will be enabled
on HttpConectionsHttpConnection.setStaleCheckingEnabled(boolean)
public void setMaxConnectionsPerHost(int maxHostConnections)
maxHostConnections
- the number of connections allowed for each
hostConfigurationpublic int getMaxConnectionsPerHost()
public void setMaxTotalConnections(int maxTotalConnections)
maxTotalConnections
- the maximum number of connections allowedpublic int getMaxTotalConnections()
public HttpConnection getConnection(HostConfiguration hostConfiguration)
HttpConnectionManager
getConnection
in interface HttpConnectionManager
HttpConnectionManager.getConnection(HostConfiguration)
public HttpConnection getConnection(HostConfiguration hostConfiguration, long timeout) throws HttpException
HttpConnectionManager
getConnection
in interface HttpConnectionManager
HttpConnectionManager.getConnection(HostConfiguration, long)
public int getConnectionsInUse(HostConfiguration hostConfiguration)
hostConfiguration
- the key that connections are tracked onpublic int getConnectionsInUse()
public void releaseConnection(HttpConnection conn)
releaseConnection
in interface HttpConnectionManager
conn
- the HttpConnection to make available.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |