org.apache.commons.httpclient
public class MultiThreadedHttpConnectionManager extends Object implements HttpConnectionManager
Since: 2.0
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) |
void | deleteClosedConnections()
Deletes all closed connections. |
HttpConnection | getConnection(HostConfiguration hostConfiguration) |
HttpConnection | getConnection(HostConfiguration hostConfiguration, long timeout) |
int | getConnectionsInPool(HostConfiguration hostConfiguration)
Gets the total number of pooled connections for the given host configuration. |
int | getConnectionsInPool()
Gets the total number of pooled connections. |
int | getConnectionsInUse(HostConfiguration hostConfiguration)
Gets the number of connections in use for this configuration.
|
int | getConnectionsInUse()
Gets the total number of connections in use.
|
HttpConnection | getConnectionWithTimeout(HostConfiguration hostConfiguration, long timeout)
Gets a connection or waits if one is not available. |
int | getMaxConnectionsPerHost()
Gets the maximum number of connections allowed for a given
hostConfiguration.
|
int | getMaxTotalConnections()
Gets the maximum number of connections allowed for this connection manager.
|
HttpConnectionManagerParams | getParams()
Returns parameters associated
with this connection manager.
|
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 for this connection manager.
|
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. |
Since: 3.0
Since: 3.0
See Also: getConnection
maximum number of connections per
host
.
Parameters: hostConfiguration The host configuration
Returns: The total number of pooled connections
maximum number of connections
.
Returns: the total number of pooled connections
Deprecated: Use getConnectionsInPool
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
Deprecated: Use getConnectionsInPool
Gets the total number of connections in use.Returns: the total number of connections in use
Parameters: hostConfiguration The host configuration specifying the connection details. timeout the number of milliseconds to wait for a connection, 0 to wait indefinitely
Returns: HttpConnection an available connection
Throws: HttpException if a connection does not become available in 'timeout' milliseconds
Since: 3.0
Deprecated: Use getDefaultMaxConnectionsPerHost, getParams.
Gets the maximum number of connections allowed for a given hostConfiguration.Returns: The maximum number of connections allowed for a given hostConfiguration.
Deprecated: Use getMaxTotalConnections, getParams.
Gets the maximum number of connections allowed for this connection manager.Returns: The maximum number of connections allowed
parameters
associated
with this connection manager.
Since: 3.0
See Also: HttpConnectionManagerParams
Deprecated: Use HttpConnectionManagerParams, getParams.
Gets the staleCheckingEnabled value to be set on HttpConnections that are created.Returns: true
if stale checking will be enabled on HttpConnections
Parameters: conn the HttpConnection to make available.
Deprecated: Use HttpConnectionManagerParams, getParams.
Sets the staleCheckingEnabled value to be set on HttpConnections that are created.Parameters: connectionStaleCheckingEnabled true
if stale checking will be enabled
on HttpConnections
Deprecated: Use HttpConnectionManagerParams, 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
Deprecated: Use HttpConnectionManagerParams, getParams.
Sets the maximum number of connections allowed for this connection manager.Parameters: maxTotalConnections the maximum number of connections allowed
The connection manager can no longer be used once shut down.
Calling this method more than once will have no effect.
See Also: shutdown