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: 578383 $
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.
 org.apache.http.params.HttpParams getParams()
          Obtains the parameters of this manager.
 SchemeRegistry getSchemeRegistry()
          Obtains the scheme registry used by this manager.
 void releaseConnection(ManagedClientConnection conn)
          Releases a connection for use by others.
 void shutdown()
          Shuts down this connection manager and releases allocated resources.
 

Method Detail

getParams

org.apache.http.params.HttpParams getParams()
Obtains the parameters of this manager.

Returns:
the parameters, never null

getSchemeRegistry

SchemeRegistry getSchemeRegistry()
Obtains the scheme registry used by this manager.

Returns:
the scheme registry, never null

getConnection

ManagedClientConnection getConnection(HttpRoute route)
                                      throws java.lang.InterruptedException
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
Throws:
java.lang.InterruptedException - if the calling thread is interrupted while waiting

getConnection

ManagedClientConnection getConnection(HttpRoute route,
                                      long timeout)
                                      throws ConnectionPoolTimeoutException,
                                             java.lang.InterruptedException
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
java.lang.InterruptedException - if the calling thread is interrupted while waiting

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.