English | Site Directory

Android - An Open Handset Alliance Project

org.apache.http.impl.conn.tsccm
public abstract class

org.apache.http.impl.conn.tsccm.AbstractConnPool

java.lang.Object
org.apache.http.impl.conn.tsccm.AbstractConnPool RefQueueHandler

An abstract connection pool. It is used by the ThreadSafeClientConnManager.

Known Direct Subclasses

Summary

Fields

protected      ConnMgrRef  connManager  The connection manager. 
protected      IdleConnectionHandler  idleConnHandler  The handler for idle connections. 
protected      boolean  isShutDown  Indicates whether this pool is shut down. 
protected      Set  issuedConnections  References to issued connections. 
protected      int  numConnections  The current total number of connections. 
protected      HttpParams  params  The parameters of this connection pool. 
protected      ReferenceQueue  refQueue  A reference queue to track loss of pool entries to GC. 

Protected Constructors

          AbstractConnPool(ClientConnectionManager mgr)
Creates a new connection pool.

Public Methods

  synchronized      void  closeIdleConnections(long idletime)
Closes idle connections.
abstract        void  deleteClosedConnections()
Deletes all entries for closed connections.
abstract        void  freeEntry(BasicPoolEntry entry)
Returns an entry into the pool.
abstract        BasicPoolEntry  getEntry(HttpRoute route, long timeout, ClientConnectionOperator operator)
Obtains a pool entry with a connection within the given timeout.
  synchronized      void  handleReference(Reference ref)
Invoked when a reference is found on the queue.
  synchronized      void  shutdown()
Shuts down this pool and all associated resources.

Protected Methods

        void  closeConnection(OperatedClientConnection conn)
Closes a connection from this pool.
abstract        void  handleLostEntry(HttpRoute route)
Handles cleaning up for a lost pool entry with the given route.
Methods inherited from class java.lang.Object
Methods inherited from interface org.apache.http.impl.conn.tsccm.RefQueueHandler

Details

Fields

protected ConnMgrRef connManager

The connection manager. This weak reference is used only to detect garbage collection of the manager. The connection pool MUST NOT keep a hard reference to the manager, or else the manager might never be GCed.

protected IdleConnectionHandler idleConnHandler

The handler for idle connections.

protected boolean isShutDown

Indicates whether this pool is shut down.

protected Set issuedConnections

References to issued connections. Objects in this set are of class BasicPoolEntryRef, and point to the pool entry for the issued connection. GCed connections are detected by the missing pool entries.

protected int numConnections

The current total number of connections.

protected HttpParams params

The parameters of this connection pool.

protected ReferenceQueue refQueue

A reference queue to track loss of pool entries to GC.

Protected Constructors

protected AbstractConnPool(ClientConnectionManager mgr)

Creates a new connection pool.

Parameters

mgr the connection manager

Public Methods

public synchronized void closeIdleConnections(long idletime)

Closes idle connections.

Parameters

idletime the time the connections should have been idle in order to be closed now

public abstract void deleteClosedConnections()

Deletes all entries for closed connections.

public abstract void freeEntry(BasicPoolEntry entry)

Returns an entry into the pool. The connection of the entry is expected to be in a suitable state, either open and re-usable, or closed. The pool will not make any attempt to determine whether it can be re-used or not.

Parameters

entry the entry for the connection to release

public abstract BasicPoolEntry getEntry(HttpRoute route, long timeout, ClientConnectionOperator operator)

Obtains a pool entry with a connection within the given timeout.

Parameters

route the route for which to get the connection
timeout the timeout, or 0 for no timeout
operator the connection operator, in case a connection has to be created

Returns

  • pool entry holding a connection for the route

Throws

ConnectionPoolTimeoutException if the timeout expired
InterruptedException if the calling thread was interrupted

public synchronized void handleReference(Reference ref)

Invoked when a reference is found on the queue.

public synchronized void shutdown()

Shuts down this pool and all associated resources. Overriding methods MUST call the implementation here!

Protected Methods

protected void closeConnection(OperatedClientConnection conn)

Closes a connection from this pool.

Parameters

conn the connection to close, or null

protected abstract void handleLostEntry(HttpRoute route)

Handles cleaning up for a lost pool entry with the given route. A lost pool entry corresponds to a connection that was garbage collected instead of being properly released.

Parameters

route the route of the pool entry that was lost
Build m5-rc15i - 10 Jun 2008 13:54