|
||||||||||
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
@ThreadSafe public abstract class AbstractConnPool
An abstract connection pool.
It is used by the ThreadSafeClientConnManager
.
The abstract pool includes a poolLock
, which is used to
synchronize access to the internal pool datastructures.
Don't use synchronized
for that purpose!
Field Summary | |
---|---|
protected IdleConnectionHandler |
idleConnHandler
The handler for idle connections. |
protected boolean |
isShutDown
Indicates whether this pool is shut down. |
protected Set<BasicPoolEntryRef> |
issuedConnections
Deprecated. |
protected Set<BasicPoolEntry> |
leasedConnections
References to issued connections. |
protected int |
numConnections
The current total number of connections. |
protected Lock |
poolLock
The global lock for this pool. |
protected ReferenceQueue<Object> |
refQueue
Deprecated. |
Constructor Summary | |
---|---|
protected |
AbstractConnPool()
Creates a new connection pool. |
Method Summary | |
---|---|
protected void |
closeConnection(OperatedClientConnection conn)
Closes a connection from this pool. |
void |
closeExpiredConnections()
|
void |
closeIdleConnections(long idletime,
TimeUnit tunit)
Closes idle connections. |
abstract void |
deleteClosedConnections()
Deletes all entries for closed connections. |
void |
enableConnectionGC()
Deprecated. do not sue |
abstract void |
freeEntry(BasicPoolEntry entry,
boolean reusable,
long validDuration,
TimeUnit timeUnit)
Returns an entry into the pool. |
BasicPoolEntry |
getEntry(HttpRoute route,
Object state,
long timeout,
TimeUnit tunit)
Obtains a pool entry with a connection within the given timeout. |
protected abstract void |
handleLostEntry(HttpRoute route)
Deprecated. |
void |
handleReference(Reference<?> ref)
Deprecated. |
abstract PoolEntryRequest |
requestPoolEntry(HttpRoute route,
Object state)
Returns a new PoolEntryRequest , from which a BasicPoolEntry
can be obtained, or the request can be aborted. |
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 final Lock poolLock
@GuardedBy(value="poolLock") protected Set<BasicPoolEntry> leasedConnections
@GuardedBy(value="poolLock") protected IdleConnectionHandler idleConnHandler
@GuardedBy(value="poolLock") protected int numConnections
protected volatile boolean isShutDown
@Deprecated protected Set<BasicPoolEntryRef> issuedConnections
@Deprecated protected ReferenceQueue<Object> refQueue
Constructor Detail |
---|
protected AbstractConnPool()
Method Detail |
---|
@Deprecated public void enableConnectionGC() throws IllegalStateException
IllegalStateException
public final BasicPoolEntry getEntry(HttpRoute route, Object state, long timeout, TimeUnit tunit) throws ConnectionPoolTimeoutException, InterruptedException
route
- the route for which to get the connectiontimeout
- the timeout, 0 or negative for no timeouttunit
- the unit for the timeout
,
may be null
only if there is no timeout
ConnectionPoolTimeoutException
- if the timeout expired
InterruptedException
- if the calling thread was interruptedpublic abstract PoolEntryRequest requestPoolEntry(HttpRoute route, Object state)
PoolEntryRequest
, from which a BasicPoolEntry
can be obtained, or the request can be aborted.
public abstract void freeEntry(BasicPoolEntry entry, boolean reusable, long validDuration, TimeUnit timeUnit)
entry
- the entry for the connection to releasereusable
- true
if the entry is deemed
reusable, false
otherwise.validDuration
- The duration that the entry should remain free and reusable.timeUnit
- The unit of time the duration is measured in.@Deprecated public void handleReference(Reference<?> ref)
RefQueueHandler
handleReference
in interface RefQueueHandler
ref
- the reference to handle@Deprecated protected abstract void handleLostEntry(HttpRoute route)
public void closeIdleConnections(long idletime, TimeUnit tunit)
idletime
- the time the connections should have been idle
in order to be closed nowtunit
- the unit for the idletime
public void closeExpiredConnections()
public 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 |