AbstractConnPool@Deprecated
public abstract class AbstractConnPool
extends java.lang.Object
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!| 限定符和类型 | 字段和说明 |
|---|---|
protected IdleConnectionHandler |
idleConnHandler
已过时。
|
protected boolean |
isShutDown
已过时。
Indicates whether this pool is shut down.
|
protected java.util.Set<BasicPoolEntryRef> |
issuedConnections
已过时。
|
protected java.util.Set<BasicPoolEntry> |
leasedConnections
已过时。
References to issued connections
|
protected int |
numConnections
已过时。
The current total number of connections.
|
protected java.util.concurrent.locks.Lock |
poolLock
已过时。
The global lock for this pool.
|
protected java.lang.ref.ReferenceQueue<java.lang.Object> |
refQueue
已过时。
|
| 限定符 | 构造器和说明 |
|---|---|
protected |
AbstractConnPool()
已过时。
Creates a new connection pool.
|
| 限定符和类型 | 方法和说明 |
|---|---|
protected void |
closeConnection(OperatedClientConnection conn)
已过时。
Closes a connection from this pool.
|
void |
closeExpiredConnections()
已过时。
|
void |
closeIdleConnections(long idletime,
java.util.concurrent.TimeUnit tunit)
已过时。
Closes idle connections.
|
abstract void |
deleteClosedConnections()
已过时。
Deletes all entries for closed connections.
|
void |
enableConnectionGC()
已过时。
|
abstract void |
freeEntry(BasicPoolEntry entry,
boolean reusable,
long validDuration,
java.util.concurrent.TimeUnit timeUnit)
已过时。
Returns an entry into the pool.
|
BasicPoolEntry |
getEntry(HttpRoute route,
java.lang.Object state,
long timeout,
java.util.concurrent.TimeUnit tunit)
已过时。
Obtains a pool entry with a connection within the given timeout.
|
protected abstract void |
handleLostEntry(HttpRoute route)
已过时。
|
void |
handleReference(java.lang.ref.Reference<?> ref)
已过时。
|
abstract PoolEntryRequest |
requestPoolEntry(HttpRoute route,
java.lang.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.
|
protected final java.util.concurrent.locks.Lock poolLock
@GuardedBy(value="poolLock") protected java.util.Set<BasicPoolEntry> leasedConnections
@GuardedBy(value="poolLock") protected int numConnections
protected volatile boolean isShutDown
protected java.util.Set<BasicPoolEntryRef> issuedConnections
protected java.lang.ref.ReferenceQueue<java.lang.Object> refQueue
protected IdleConnectionHandler idleConnHandler
public void enableConnectionGC()
throws java.lang.IllegalStateException
java.lang.IllegalStateExceptionpublic final BasicPoolEntry getEntry(HttpRoute route, java.lang.Object state, long timeout, java.util.concurrent.TimeUnit tunit) throws ConnectionPoolTimeoutException, java.lang.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 timeoutConnectionPoolTimeoutException - if the timeout expiredjava.lang.InterruptedException - if the calling thread was interruptedpublic abstract PoolEntryRequest requestPoolEntry(HttpRoute route, java.lang.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, java.util.concurrent.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.public void handleReference(java.lang.ref.Reference<?> ref)
protected abstract void handleLostEntry(HttpRoute route)
public void closeIdleConnections(long idletime,
java.util.concurrent.TimeUnit tunit)
idletime - the time the connections should have been idle
in order to be closed nowtunit - the unit for the idletimepublic void closeExpiredConnections()
public abstract void deleteClosedConnections()
public void shutdown()
protected void closeConnection(OperatedClientConnection conn)
conn - the connection to close, or null