Save This Page
Home » httpcomponents-client-4.0.1-src » org.apache » http » impl » conn » tsccm » [javadoc | source]
org.apache.http.impl.conn.tsccm
public class: ThreadSafeClientConnManager [javadoc | source]
java.lang.Object
   org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager

All Implemented Interfaces:
    ClientConnectionManager

Manages a pool of client connections and is able to service connection requests from multiple execution threads. Connections are pooled on a per route basis. A request for a route which already the manager has persistent connections for available in the pool will be services by leasing a connection from the pool rather than creating a brand new connection.

ThreadSafeClientConnManager maintains a maximum limit of connection on a per route basis and in total. Per default this implementation will create no more than than 2 concurrent connections per given route and no more 20 connections in total. For many real-world applications these limits may prove too constraining, especially if they use HTTP as a transport protocol for their services. Connection limits, however, can be adjusted using HTTP parameters.

The following parameters can be used to customize the behavior of this class:

Field Summary
protected final  SchemeRegistry schemeRegistry    The schemes supported by this connection manager. 
protected final  AbstractConnPool connectionPool    The pool of connections being managed. 
protected final  ClientConnectionOperator connOperator    The operator for opening and updating connections. 
Constructor:
 public ThreadSafeClientConnManager(HttpParams params,
    SchemeRegistry schreg) 
    Creates a new thread safe connection manager.
    Parameters:
    params - the parameters for this manager.
    schreg - the scheme registry.
Method from org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager Summary:
closeExpiredConnections,   closeIdleConnections,   createConnectionOperator,   createConnectionPool,   finalize,   getConnectionsInPool,   getConnectionsInPool,   getSchemeRegistry,   releaseConnection,   requestConnection,   shutdown
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager Detail:
 public  void closeExpiredConnections() 
 public  void closeIdleConnections(long idleTimeout,
    TimeUnit tunit) 
 protected ClientConnectionOperator createConnectionOperator(SchemeRegistry schreg) 
    Hook for creating the connection operator. It is called by the constructor. Derived classes can override this method to change the instantiation of the operator. The default implementation here instantiates DefaultClientConnectionOperator .
 protected AbstractConnPool createConnectionPool(HttpParams params) 
    Hook for creating the connection pool.
 protected  void finalize() throws Throwable 
 public int getConnectionsInPool() 
    Gets the total number of pooled connections. This is the total number of connections that have been created and are still in use by this connection manager. This value will not exceed the maximum number of connections in total.
 public int getConnectionsInPool(HttpRoute route) 
    Gets the total number of pooled connections for the given route. This is the total number of connections that have been created and are still in use by this connection manager for the route. This value will not exceed the maximum number of connections per host.
 public SchemeRegistry getSchemeRegistry() 
 public  void releaseConnection(ManagedClientConnection conn,
    long validDuration,
    TimeUnit timeUnit) 
 public ClientConnectionRequest requestConnection(HttpRoute route,
    Object state) 
 public  void shutdown()