org.apache.commons.httpclient
Interface HttpConnectionManager

All Known Implementing Classes:
SimpleHttpConnectionManager, MultiThreadedHttpConnectionManager

public interface HttpConnectionManager

An interface for classes that manage HttpConnections.

Since:
2.0
Author:
Unascribed, Mike Bowler
See Also:
HttpConnection, HttpClient.HttpClient(HttpConnectionManager)

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.
 void releaseConnection(HttpConnection conn)
          Releases the given HttpConnection for use by other requests.
 

Method Detail

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.
Parameters:
hostConfiguration - the host configuration to use to configure the connection
Returns:
an HttpConnection for the given configuration
See Also:
HttpConnection.setHttpConnectionManager(HttpConnectionManager)

getConnection

public HttpConnection getConnection(HostConfiguration hostConfiguration,
                                    long timeout)
                             throws HttpException
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.
Parameters:
hostConfiguration - the host configuration to use to configure the connection
timeout - - the time (in milliseconds) to wait for a connection to become available, 0 to specify an infinite timeout
Returns:
an HttpConnection for the given configuraiton
Throws:
HttpException - if no connection becomes available before the timeout expires
See Also:
HttpConnection.setHttpConnectionManager(HttpConnectionManager)

releaseConnection

public void releaseConnection(HttpConnection conn)
Releases the given HttpConnection for use by other requests.
Parameters:
conn - - The HttpConnection to make available.


Copyright © 2001-2004 Apache Software Foundation. All Rights Reserved.