Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
org.apache.commons.httpclient.MultiThreadedHttpConnectionManager
public class MultiThreadedHttpConnectionManager
extends java.lang.Object
implements HttpConnectionManager
Field Summary | |
static int |
|
static int |
|
Constructor Summary | |
|
Method Summary | |
void |
|
void |
|
HttpConnection |
|
HttpConnection |
|
HttpConnection |
|
int |
|
int |
|
int |
|
int |
|
int | |
int | |
HttpConnectionManagerParams |
|
boolean | |
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
static void |
|
public static final int DEFAULT_MAX_HOST_CONNECTIONS
The default maximum number of connections allowed per host
- Field Value:
- 2
public static final int DEFAULT_MAX_TOTAL_CONNECTIONS
The default maximum number of connections allowed overall
- Field Value:
- 20
public void closeIdleConnections(long idleTimeout)
- Specified by:
- closeIdleConnections in interface HttpConnectionManager
- Since:
- 3.0
public void deleteClosedConnections()
Deletes all closed connections. Only connections currently owned by the connection manager are processed.
- Since:
- 3.0
- See Also:
HttpConnection.isOpen()
public HttpConnection getConnection(HostConfiguration hostConfiguration)
- Specified by:
- getConnection in interface HttpConnectionManager
public HttpConnection getConnection(HostConfiguration hostConfiguration, long timeout) throws HttpException
Deprecated. Use #getConnectionWithTimeout(HostConfiguration, long)
- Specified by:
- getConnection in interface HttpConnectionManager
public HttpConnection getConnectionWithTimeout(HostConfiguration hostConfiguration, long timeout) throws ConnectionPoolTimeoutException
- Specified by:
- getConnectionWithTimeout in interface HttpConnectionManager
- Since:
- 3.0
public int getConnectionsInPool()
Gets the total number of pooled connections. This is the total number of connections that have been created and are still in use by this connection manager. This value will not exceed themaximum number of connections
.
- Returns:
- the total number of pooled connections
public int getConnectionsInPool(HostConfiguration hostConfiguration)
Gets the total number of pooled connections for the given host configuration. This is the total number of connections that have been created and are still in use by this connection manager for the host configuration. This value will not exceed themaximum number of connections per host
.
- Parameters:
hostConfiguration
- The host configuration
- Returns:
- The total number of pooled connections
public int getConnectionsInUse()
Deprecated. Use
getConnectionsInPool()
Gets the total number of connections in use.
- Returns:
- the total number of connections in use
public int getConnectionsInUse(HostConfiguration hostConfiguration)
Deprecated. Use
getConnectionsInPool(HostConfiguration)
Gets the number of connections in use for this configuration.
- Parameters:
hostConfiguration
- the key that connections are tracked on
- Returns:
- the number of connections in use
public int getMaxConnectionsPerHost()
Deprecated. Use
HttpConnectionManagerParams.getDefaultMaxConnectionsPerHost()
,HttpConnectionManager.getParams()
.Gets the maximum number of connections allowed for a given hostConfiguration.
- Returns:
- The maximum number of connections allowed for a given hostConfiguration.
public int getMaxTotalConnections()
Deprecated. Use
HttpConnectionManagerParams.getMaxTotalConnections()
,HttpConnectionManager.getParams()
.Gets the maximum number of connections allowed for this connection manager.
- Returns:
- The maximum number of connections allowed
public HttpConnectionManagerParams getParams()
Returnsparameters
associated with this connection manager.
- Specified by:
- getParams in interface HttpConnectionManager
- Since:
- 3.0
- See Also:
HttpConnectionManagerParams
public boolean isConnectionStaleCheckingEnabled()
Deprecated. Use
HttpConnectionManagerParams.isStaleCheckingEnabled()
,HttpConnectionManager.getParams()
.Gets the staleCheckingEnabled value to be set on HttpConnections that are created.
- Returns:
true
if stale checking will be enabled on HttpConnections
public void releaseConnection(HttpConnection conn)
Make the given HttpConnection available for use by other requests. If another thread is blocked in getConnection() that could use this connection, it will be woken up.
- Specified by:
- releaseConnection in interface HttpConnectionManager
- Parameters:
conn
- the HttpConnection to make available.
public void setConnectionStaleCheckingEnabled(boolean connectionStaleCheckingEnabled)
Deprecated. Use
HttpConnectionManagerParams.setStaleCheckingEnabled(boolean)
,HttpConnectionManager.getParams()
.Sets the staleCheckingEnabled value to be set on HttpConnections that are created.
- Parameters:
connectionStaleCheckingEnabled
-true
if stale checking will be enabled on HttpConnections
public void setMaxConnectionsPerHost(int maxHostConnections)
Deprecated. Use
HttpConnectionManagerParams.setDefaultMaxConnectionsPerHost(int)
,HttpConnectionManager.getParams()
.Sets the maximum number of connections allowed for a given HostConfiguration. Per RFC 2616 section 8.1.4, this value defaults to 2.
- Parameters:
maxHostConnections
- the number of connections allowed for each hostConfiguration
public void setMaxTotalConnections(int maxTotalConnections)
Deprecated. Use
HttpConnectionManagerParams.setMaxTotalConnections(int)
,HttpConnectionManager.getParams()
.Sets the maximum number of connections allowed for this connection manager.
- Parameters:
maxTotalConnections
- the maximum number of connections allowed
public void setParams(HttpConnectionManagerParams params)
Assignsparameters
for this connection manager.
- Specified by:
- setParams in interface HttpConnectionManager
- Since:
- 3.0
- See Also:
HttpConnectionManagerParams
public void shutdown()
Shuts down the connection manager and releases all resources. All connections associated with this class will be closed and released. The connection manager can no longer be used once shutdown. Calling this method more than once will have no effect.
public static void shutdownAll()
Shuts down and cleans up resources used by all instances of MultiThreadedHttpConnectionManager. All static resources are released, all threads are stopped, andshutdown()
is called on all live instances of MultiThreadedHttpConnectionManager.
- See Also:
shutdown()