|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.http.impl.conn.tsccm.AbstractConnPool
public abstract class AbstractConnPool
An abstract connection pool.
It is used by the ThreadSafeClientConnManager
.
Field Summary | |
---|---|
protected org.apache.http.impl.conn.tsccm.AbstractConnPool.ConnMgrRef |
connManager
The connection manager. |
protected IdleConnectionHandler |
idleConnHandler
The handler for idle connections. |
protected boolean |
isShutDown
Indicates whether this pool is shut down. |
protected java.util.Set |
issuedConnections
References to issued connections. |
protected int |
numConnections
The current total number of connections. |
protected org.apache.http.params.HttpParams |
params
The parameters of this connection pool. |
protected java.lang.ref.ReferenceQueue |
refQueue
A reference queue to track loss of pool entries to GC. |
Constructor Summary | |
---|---|
protected |
AbstractConnPool(ClientConnectionManager mgr)
Creates a new connection pool. |
Method Summary | |
---|---|
protected void |
closeConnection(OperatedClientConnection conn)
Closes a connection from this pool. |
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. |
protected abstract void |
handleLostEntry(HttpRoute route)
Handles cleaning up for a lost pool entry with the given route. |
void |
handleReference(java.lang.ref.Reference ref)
Invoked when a reference is found on the queue. |
void |
shutdown()
Shuts down this pool and all associated resources. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.util.Set issuedConnections
BasicPoolEntryRef
,
and point to the pool entry for the issued connection.
GCed connections are detected by the missing pool entries.
protected IdleConnectionHandler idleConnHandler
protected int numConnections
protected org.apache.http.params.HttpParams params
protected org.apache.http.impl.conn.tsccm.AbstractConnPool.ConnMgrRef connManager
protected java.lang.ref.ReferenceQueue refQueue
protected volatile boolean isShutDown
Constructor Detail |
---|
protected AbstractConnPool(ClientConnectionManager mgr)
mgr
- the connection managerMethod Detail |
---|
public abstract BasicPoolEntry getEntry(HttpRoute route, long timeout, ClientConnectionOperator operator) throws ConnectionPoolTimeoutException, java.lang.InterruptedException
route
- the route for which to get the connectiontimeout
- the timeout, or 0 for no timeoutoperator
- the connection operator, in case
a connection has to be created
ConnectionPoolTimeoutException
- if the timeout expired
java.lang.InterruptedException
- if the calling thread was interruptedpublic abstract void freeEntry(BasicPoolEntry entry)
entry
- the entry for the connection to releasepublic void handleReference(java.lang.ref.Reference ref)
RefQueueHandler
handleReference
in interface RefQueueHandler
ref
- the reference to handleprotected abstract void handleLostEntry(HttpRoute route)
route
- the route of the pool entry that was lostpublic void closeIdleConnections(long idletime)
idletime
- the time the connections should have been idle
in order to be closed nowpublic abstract void deleteClosedConnections()
public void shutdown()
protected void closeConnection(OperatedClientConnection conn)
conn
- the connection to close, or null
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |