org.apache.http.conn
Interface ClientConnectionManager

All Known Implementing Classes:
SingleClientConnManager, ThreadSafeClientConnManager

public interface ClientConnectionManager

Management interface for client connections.

Since:
4.0
Version:
$Revision: 534769 $
Author:
Michael Becke, Mike Bowler, Oleg Kalnichevski, Roland Weber

Method Summary
 void closeIdleConnections(long idletime)
          Closes idle connections in the pool.
 ManagedClientConnection getConnection(HttpRoute route)
          Obtains a connection.
 ManagedClientConnection getConnection(HttpRoute route, long timeout)
          Obtains a connection within a given time.
 SchemeRegistry getSchemeRegistry()
           
 void releaseConnection(ManagedClientConnection conn)
          Releases a connection for use by others.
 void shutdown()
          Shuts down this connection manager and releases allocated resources.
 

Method Detail

getSchemeRegistry

SchemeRegistry getSchemeRegistry()

getConnection

ManagedClientConnection getConnection(HttpRoute route)
Obtains a connection. This method will block until a connection becomes available or the connection manager is shut down.

Parameters:
route - where the connection should point to
Returns:
a connection that can be used to communicate along the given route

getConnection

ManagedClientConnection getConnection(HttpRoute route,
                                      long timeout)
                                      throws ConnectionPoolTimeoutException
Obtains a connection within a given time. This method will block until a connection becomes available, the timeout expires, or the connection manager is shut down.

Parameters:
route - where the connection should point to
timeout - the timeout in milliseconds
Returns:
a connection that can be used to communicate along the given route
Throws:
ConnectionPoolTimeoutException - in case of a timeout

releaseConnection

void releaseConnection(ManagedClientConnection conn)
Releases a connection for use by others. If the argument connection has been released before, the call will be ignored.

Parameters:
conn - the connection to release

closeIdleConnections

void closeIdleConnections(long idletime)
Closes idle connections in the pool. Open connections in the pool that have not been used for the timespan given by the timeout argument will be closed. Currently allocated connections are not subject to this method.

Parameters:
idletime - the idle time in milliseconds

shutdown

void shutdown()
Shuts down this connection manager and releases allocated resources. This includes closing all connections, whether they are currently used or not.



Copyright © 2000-2007 Apache Software Foundation. All Rights Reserved.