Top Description Fields Constructors Methods
org.apache.http.impl.conn.tsccm

public abstract Class AbstractConnPool

extends Object
Class Inheritance
Known Direct Subclasses
org.apache.http.impl.conn.tsccm.ConnPoolByRoute
Annotations
@Deprecated
Imports
java.io.IOException, java.lang.ref.Reference, .ReferenceQueue, java.util.HashSet, .Iterator, .Set, java.util.concurrent.TimeUnit, java.util.concurrent.locks.Lock, .ReentrantLock, org.apache.commons.logging.Log, .LogFactory, org.apache.http.conn.ConnectionPoolTimeoutException, .OperatedClientConnection, org.apache.http.conn.routing.HttpRoute, org.apache.http.impl.conn.IdleConnectionHandler, org.apache.http.util.Args

Deprecated

(4.2) use org.apache.http.pool.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!
Since
4.0

Field Summary

Modifier and TypeField and Description
protected IdleConnectionHandler
idleConnHandler

Deprecated as a consequence of IdleConnectionHandler being deprecated.
protected volatile boolean
isShutDown

Indicates whether this pool is shut down.

protected Set<BasicPoolEntryRef>
protected Set<BasicPoolEntry>
private final Log
protected int
protected final Lock
poolLock

The global lock for this pool.

protected ReferenceQueue<Object>

Constructor Summary

AccessConstructor and Description
protected
AbstractConnPool()

Creates a new connection pool.

Method Summary

Modifier and TypeMethod and Description
protected void
closeConnection(final OperatedClientConnection
the connection to close, or null
conn
)

Deprecated as a consequence of OperatedClientConnection being deprecated.
Closes a connection from this pool.
public void
public void
closeIdleConnections(final long
the time the connections should have been idle in order to be closed now
idletime
,
final TimeUnit
the unit for the idletime
timeUnit
)

Closes idle connections.

public abstract void
deleteClosedConnections()

Deletes all entries for closed connections.

public void
public abstract void
freeEntry(BasicPoolEntry
the entry for the connection to release
entry
,
boolean
true if the entry is deemed reusable, false otherwise.
reusable
,
long
The duration that the entry should remain free and reusable.
validDuration
,
TimeUnit
The unit of time the duration is measured in.
timeUnit
)

Deprecated as a consequence of BasicPoolEntry being deprecated.
Returns an entry into the pool.
public final BasicPoolEntry

Returns:

pool entry holding a connection for the route
getEntry
(final HttpRoute
the route for which to get the connection
route
,
final Object
the state
state
,
final long
the timeout, 0 or negative for no timeout
timeout
,
final TimeUnit
the unit for the timeout, may be null only if there is no timeout
timeUnit
)

Deprecated as a consequence of BasicPoolEntry being deprecated.
Obtains a pool entry with a connection within the given timeout.
protected abstract void
public void
handleReference(final Reference<?> ref)

public abstract PoolEntryRequest

Returns:

the entry request
requestPoolEntry
(HttpRoute
the route
route
,
Object
the state
state
)

Deprecated as a consequence of PoolEntryRequest being deprecated.
Returns a new PoolEntryRequest, from which a BasicPoolEntry can be obtained, or the request can be aborted.
public void
shutdown()

Shuts down this pool and all associated resources.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

idleConnHandlerback to summary
protected IdleConnectionHandler idleConnHandler

Deprecated

as a consequence of IdleConnectionHandler being deprecated. See corresponding docs for further information.

isShutDownback to summary
protected volatile boolean isShutDown

Indicates whether this pool is shut down.

issuedConnectionsback to summary
protected Set<BasicPoolEntryRef> issuedConnections
leasedConnectionsback to summary
protected Set<BasicPoolEntry> leasedConnections
logback to summary
private final Log log
numConnectionsback to summary
protected int numConnections
poolLockback to summary
protected final Lock poolLock

The global lock for this pool.

refQueueback to summary
protected ReferenceQueue<Object> refQueue

Constructor Detail

AbstractConnPoolback to summary
protected AbstractConnPool()

Creates a new connection pool.

Method Detail

closeConnectionback to summary
protected void closeConnection(final OperatedClientConnection conn)

Deprecated

as a consequence of OperatedClientConnection being deprecated. See corresponding docs for further information.

Closes a connection from this pool.

Parameters
conn:OperatedClientConnection

the connection to close, or null

closeExpiredConnectionsback to summary
public void closeExpiredConnections()
closeIdleConnectionsback to summary
public void closeIdleConnections(final long idletime, final TimeUnit timeUnit)

Closes idle connections.

Parameters
idletime:long

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

timeUnit:TimeUnit

the unit for the idletime

deleteClosedConnectionsback to summary
public abstract void deleteClosedConnections()

Deletes all entries for closed connections.

enableConnectionGCback to summary
public void enableConnectionGC() throws IllegalStateException
freeEntryback to summary
public abstract void freeEntry(BasicPoolEntry entry, boolean reusable, long validDuration, TimeUnit timeUnit)

Deprecated

as a consequence of BasicPoolEntry being deprecated. See corresponding docs for further information.

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:BasicPoolEntry

the entry for the connection to release

reusable:boolean

true if the entry is deemed reusable, false otherwise.

validDuration:long

The duration that the entry should remain free and reusable.

timeUnit:TimeUnit

The unit of time the duration is measured in.

getEntryback to summary
public final BasicPoolEntry getEntry(final HttpRoute route, final Object state, final long timeout, final TimeUnit timeUnit) throws ConnectionPoolTimeoutException, InterruptedException

Deprecated

as a consequence of BasicPoolEntry being deprecated. See corresponding docs for further information.

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

Parameters
route:HttpRoute

the route for which to get the connection

state:Object

the state

timeout:long

the timeout, 0 or negative for no timeout

timeUnit:TimeUnit

the unit for the timeout, may be null only if there is no timeout

Returns:BasicPoolEntry

pool entry holding a connection for the route

Exceptions
ConnectionPoolTimeoutException:
if the timeout expired
InterruptedException:
if the calling thread was interrupted
handleLostEntryback to summary
protected abstract void handleLostEntry(HttpRoute route)
handleReferenceback to summary
public void handleReference(final Reference<?> ref)
requestPoolEntryback to summary
public abstract PoolEntryRequest requestPoolEntry(HttpRoute route, Object state)

Deprecated

as a consequence of PoolEntryRequest being deprecated. See corresponding docs for further information.

Returns a new PoolEntryRequest, from which a BasicPoolEntry can be obtained, or the request can be aborted.

Parameters
route:HttpRoute

the route

state:Object

the state

Returns:PoolEntryRequest

the entry request

shutdownback to summary
public void shutdown()

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