java.lang.Object | |
↳ | org.apache.http.impl.conn.tsccm.RouteSpecificPool |
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.
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
freeEntries | The list of free entries. | ||||||||||
maxEntries | the maximum number of entries allowed for this pool | ||||||||||
numEntries | The number of created entries. | ||||||||||
route | The route this pool is for. | ||||||||||
waitingThreads | The list of threads waiting for this pool. |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates a new route-specific pool.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Obtains a free entry from this pool, if one is available.
| |||||||||||
Indicates creation of an entry for this pool.
| |||||||||||
Deletes an entry from this pool.
| |||||||||||
Forgets about an entry from this pool.
| |||||||||||
Returns an allocated entry to this pool.
| |||||||||||
Return remaining capacity of this pool
| |||||||||||
Obtains the number of entries.
| |||||||||||
Obtains the maximum number of entries allowed for this pool.
| |||||||||||
Obtains the route for which this pool is specific.
| |||||||||||
Checks whether there is a waiting thread in this pool.
| |||||||||||
Indicates whether this pool is unused.
| |||||||||||
Returns the next thread in the queue.
| |||||||||||
Adds a waiting thread.
| |||||||||||
Removes a waiting thread, if it is queued.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
The list of free entries. This list is managed LIFO, to increase idle times and allow for closing connections that are not really needed.
the maximum number of entries allowed for this pool
The list of threads waiting for this pool.
Creates a new route-specific pool.
route | the route for which to pool |
---|---|
maxEntries | the maximum number of entries allowed for this pool |
Obtains a free entry from this pool, if one is available.
null
if there is none
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
.
entry | the entry that was created for this pool |
---|
Deletes an entry from this pool. Only entries that are currently free in this pool can be deleted. Allocated entries can not be deleted.
entry | the entry to delete from this pool |
---|
true
if the entry was found and deleted, or
false
if the entry was not found
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.
Returns an allocated entry to this pool.
entry | the entry obtained from allocEntry
or presented to createdEntry
|
---|
Return remaining capacity of this pool
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.
Obtains the maximum number of entries allowed for this pool.
Obtains the route for which this pool is specific.
Checks whether there is a waiting thread in this pool.
true
if there is a waiting thread,
false
otherwise
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.
true
if this pool is unused,
false
otherwise
Returns the next thread in the queue.
null
if there is none
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.
wt | the waiting thread |
---|
Removes a waiting thread, if it is queued.
wt | the waiting thread |
---|