AbstractConnPool
@Deprecated public abstract class AbstractConnPool extends 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!Modifier and Type | Field and Description |
---|---|
protected IdleConnectionHandler |
idleConnHandler
Deprecated.
|
protected boolean |
isShutDown
Deprecated.
Indicates whether this pool is shut down.
|
protected Set<BasicPoolEntryRef> |
issuedConnections
Deprecated.
|
protected Set<BasicPoolEntry> |
leasedConnections
Deprecated.
|
protected int |
numConnections
Deprecated.
|
protected Lock |
poolLock
Deprecated.
The global lock for this pool.
|
protected ReferenceQueue<Object> |
refQueue
Deprecated.
|
Modifier | Constructor and Description |
---|---|
protected |
AbstractConnPool()
Deprecated.
Creates a new connection pool.
|
Modifier and Type | Method and Description |
---|---|
protected void |
closeConnection(OperatedClientConnection conn)
Deprecated.
Closes a connection from this pool.
|
void |
closeExpiredConnections()
Deprecated.
|
void |
closeIdleConnections(long idletime,
TimeUnit timeUnit)
Deprecated.
Closes idle connections.
|
abstract void |
deleteClosedConnections()
Deprecated.
Deletes all entries for closed connections.
|
void |
enableConnectionGC()
Deprecated.
|
abstract void |
freeEntry(BasicPoolEntry entry,
boolean reusable,
long validDuration,
TimeUnit timeUnit)
Deprecated.
Returns an entry into the pool.
|
BasicPoolEntry |
getEntry(HttpRoute route,
Object state,
long timeout,
TimeUnit timeUnit)
Deprecated.
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)
Deprecated.
Returns a new
PoolEntryRequest , from which a BasicPoolEntry
can be obtained, or the request can be aborted. |
void |
shutdown()
Deprecated.
Shuts down this pool and all associated resources.
|
protected final Lock poolLock
protected Set<BasicPoolEntry> leasedConnections
protected int numConnections
protected volatile boolean isShutDown
protected Set<BasicPoolEntryRef> issuedConnections
protected ReferenceQueue<Object> refQueue
protected IdleConnectionHandler idleConnHandler
protected AbstractConnPool()
public void enableConnectionGC() throws IllegalStateException
IllegalStateException
public final BasicPoolEntry getEntry(HttpRoute route, Object state, long timeout, TimeUnit timeUnit) throws ConnectionPoolTimeoutException, InterruptedException
route
- the route for which to get the connectionstate
- the statetimeout
- the timeout, 0 or negative for no timeouttimeUnit
- the unit for the timeout
,
may be null
only if there is no timeoutConnectionPoolTimeoutException
- if the timeout expiredInterruptedException
- 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.route
- the routestate
- the statepublic 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.public void handleReference(Reference<?> ref)
protected abstract void handleLostEntry(HttpRoute route)
public void closeIdleConnections(long idletime, TimeUnit timeUnit)
idletime
- the time the connections should have been idle
in order to be closed nowtimeUnit
- 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
Copyright © 1999–2022 The Apache Software Foundation. All rights reserved.