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

public Class RouteSpecificPool

extends Object
Class Inheritance
Annotations
@Deprecated
Imports
java.io.IOException, java.util.LinkedList, .ListIterator, .Queue, org.apache.commons.logging.Log, .LogFactory, org.apache.http.conn.OperatedClientConnection, org.apache.http.conn.params.ConnPerRoute, org.apache.http.conn.routing.HttpRoute, org.apache.http.util.Args, .Asserts, .LangUtils

Deprecated

(4.2) use org.apache.http.pool.AbstractConnPool

A connection sub-pool for a specific route, used by ConnPoolByRoute. The methods in this class are unsynchronized. It is expected that the containing pool takes care of synchronization.
Since
4.0

Field Summary

Modifier and TypeField and Description
protected final ConnPerRoute
connPerRoute

Connections per route

protected final LinkedList<BasicPoolEntry>
freeEntries

The list of free entries.

private final Log
protected final int
protected int
numEntries

The number of created entries.

protected final HttpRoute
route

The route this pool is for.

protected final Queue<WaitingThread>
waitingThreads

The list of threads waiting for this pool.

Constructor Summary

AccessConstructor and Description
public
RouteSpecificPool(final HttpRoute route, final int maxEntries)

public
RouteSpecificPool(final HttpRoute
the route for which to pool
route
,
final ConnPerRoute
the connections per route configuration
connPerRoute
)

Deprecated as a consequence of ConnPerRoute being deprecated.
Creates a new route-specific pool.

Method Summary

Modifier and TypeMethod and Description
public BasicPoolEntry

Returns:

an available pool entry, or null if there is none
allocEntry
(final Object state)

Deprecated as a consequence of BasicPoolEntry being deprecated.
Obtains a free entry from this pool, if one is available.
public void
createdEntry(final BasicPoolEntry
the entry that was created for this pool
entry
)

Deprecated as a consequence of BasicPoolEntry being deprecated.
Indicates creation of an entry for this pool.
public boolean

Returns:

true if the entry was found and deleted, or false if the entry was not found
deleteEntry
(final BasicPoolEntry
the entry to delete from this pool
entry
)

Deprecated as a consequence of BasicPoolEntry being deprecated.
Deletes an entry from this pool.
public void
dropEntry()

Forgets about an entry from this pool.

public void
freeEntry(final BasicPoolEntry
the entry obtained from allocEntry or presented to createdEntry
entry
)

Deprecated as a consequence of BasicPoolEntry being deprecated.
Returns an allocated entry to this pool.
public int

Returns:

capacity
getCapacity
()

Return remaining capacity of this pool

public final int

Returns:

the number of entries for the route of this pool
getEntryCount
()

Obtains the number of entries.

public final int

Returns:

the max entry number
getMaxEntries
()

Obtains the maximum number of entries allowed for this pool.

public final HttpRoute

Returns:

the route
getRoute
()

Obtains the route for which this pool is specific.

public boolean

Returns:

true if there is a waiting thread, false otherwise
hasThread
()

Checks whether there is a waiting thread in this pool.

public boolean

Returns:

true if this pool is unused, false otherwise
isUnused
()

Indicates whether this pool is unused.

public WaitingThread

Returns:

a waiting thread, or null if there is none
nextThread
()

Deprecated as a consequence of WaitingThread being deprecated.
Returns the next thread in the queue.
public void
queueThread(final WaitingThread
the waiting thread
wt
)

Deprecated as a consequence of WaitingThread being deprecated.
Adds a waiting thread.
public void
removeThread(final WaitingThread
the waiting thread
wt
)

Deprecated as a consequence of WaitingThread being deprecated.
Removes a waiting thread, if it is queued.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

connPerRouteback to summary
protected final ConnPerRoute connPerRoute

Deprecated

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

Connections per route

freeEntriesback to summary
protected final LinkedList<BasicPoolEntry> freeEntries

The list of free entries. This list is managed LIFO, to increase idle times and allow for closing connections that are not really needed.

logback to summary
private final Log log
maxEntriesback to summary
protected final int maxEntries
numEntriesback to summary
protected int numEntries

The number of created entries.

routeback to summary
protected final HttpRoute route

The route this pool is for.

waitingThreadsback to summary
protected final Queue<WaitingThread> waitingThreads

The list of threads waiting for this pool.

Constructor Detail

RouteSpecificPoolback to summary
public RouteSpecificPool(final HttpRoute route, final int maxEntries)
Annotations
@Deprecated
RouteSpecificPoolback to summary
public RouteSpecificPool(final HttpRoute route, final ConnPerRoute connPerRoute)

Deprecated

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

Creates a new route-specific pool.

Parameters
route:HttpRoute

the route for which to pool

connPerRoute:ConnPerRoute

the connections per route configuration

Method Detail

allocEntryback to summary
public BasicPoolEntry allocEntry(final Object state)

Deprecated

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

Obtains a free entry from this pool, if one is available.

Returns:BasicPoolEntry

an available pool entry, or null if there is none

createdEntryback to summary
public void createdEntry(final BasicPoolEntry entry)

Deprecated

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

Indicates creation of an entry for this pool. The entry will not be added to the list of free entries, it is only recognized as belonging to this pool now. It can then be passed to freeEntry.

Parameters
entry:BasicPoolEntry

the entry that was created for this pool

deleteEntryback to summary
public boolean deleteEntry(final BasicPoolEntry entry)

Deprecated

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

Deletes an entry from this pool. Only entries that are currently free in this pool can be deleted. Allocated entries can not be deleted.

Parameters
entry:BasicPoolEntry

the entry to delete from this pool

Returns:boolean

true if the entry was found and deleted, or false if the entry was not found

dropEntryback to summary
public void dropEntry()

Forgets about an entry from this pool. This method is used to indicate that an entry allocated from this pool has been lost and will not be returned.

freeEntryback to summary
public void freeEntry(final BasicPoolEntry entry)

Deprecated

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

Returns an allocated entry to this pool.

Parameters
entry:BasicPoolEntry

the entry obtained from allocEntry or presented to createdEntry

getCapacityback to summary
public int getCapacity()

Return remaining capacity of this pool

Returns:int

capacity

getEntryCountback to summary
public final int getEntryCount()

Obtains the number of entries. This includes not only the free entries, but also those that have been created and are currently issued to an application.

Returns:int

the number of entries for the route of this pool

getMaxEntriesback to summary
public final int getMaxEntries()

Obtains the maximum number of entries allowed for this pool.

Returns:int

the max entry number

getRouteback to summary
public final HttpRoute getRoute()

Obtains the route for which this pool is specific.

Returns:HttpRoute

the route

hasThreadback to summary
public boolean hasThread()

Checks whether there is a waiting thread in this pool.

Returns:boolean

true if there is a waiting thread, false otherwise

isUnusedback to summary
public boolean isUnused()

Indicates whether this pool is unused. A pool is unused if there is neither an entry nor a waiting thread. All entries count, not only the free but also the allocated ones.

Returns:boolean

true if this pool is unused, false otherwise

nextThreadback to summary
public WaitingThread nextThread()

Deprecated

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

Returns the next thread in the queue.

Returns:WaitingThread

a waiting thread, or null if there is none

queueThreadback to summary
public void queueThread(final WaitingThread wt)

Deprecated

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

Adds a waiting thread. This pool makes no attempt to match waiting threads with pool entries. It is the caller's responsibility to check that there is no entry before adding a waiting thread.

Parameters
wt:WaitingThread

the waiting thread

removeThreadback to summary
public void removeThread(final WaitingThread wt)

Deprecated

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

Removes a waiting thread, if it is queued.

Parameters
wt:WaitingThread

the waiting thread