org.apache.commons.httpclient
Interface HttpConnectionManager
- MultiThreadedHttpConnectionManager, SimpleHttpConnectionManager
public interface HttpConnectionManager
An interface for classes that manage HttpConnections.
closeIdleConnections
public void closeIdleConnections(long idleTimeout)
Closes connections that have been idle for at least the given amount of time. Only
connections that are currently owned, not checked out, are subject to idle timeouts.
idleTimeout
- the minimum idle time, in milliseconds, for connections to be closed
getConnection
public HttpConnection getConnection(HostConfiguration hostConfiguration)
Gets an HttpConnection for a given host configuration. If a connection is
not available this method will block until one is.
The connection manager should be registered with any HttpConnection that
is created.
hostConfiguration
- the host configuration to use to configure the
connection
- an HttpConnection for the given configuration
getConnection
public HttpConnection getConnection(HostConfiguration hostConfiguration,
long timeout)
throws HttpException
Use #getConnectionWithTimeout(HostConfiguration, long)
Gets an HttpConnection for a given host configuration. If a connection is
not available, this method will block for at most the specified number of
milliseconds or until a connection becomes available.
The connection manager should be registered with any HttpConnection that
is created.
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
- an HttpConnection for the given configuraiton
HttpException
- if no connection becomes available before the
timeout expires
getConnectionWithTimeout
public HttpConnection getConnectionWithTimeout(HostConfiguration hostConfiguration,
long timeout)
throws ConnectionPoolTimeoutException
Gets an HttpConnection for a given host configuration. If a connection is
not available, this method will block for at most the specified number of
milliseconds or until a connection becomes available.
The connection manager should be registered with any HttpConnection that
is created.
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
- an HttpConnection for the given configuraiton
releaseConnection
public void releaseConnection(HttpConnection conn)
Releases the given HttpConnection for use by other requests.
conn
- - The HttpConnection to make available.
Copyright (c) 1999-2005 - Apache Software Foundation