org.apache.http.impl.conn.tsccm
Class RouteSpecificPool

java.lang.Object
  extended by org.apache.http.impl.conn.tsccm.RouteSpecificPool

public class RouteSpecificPool
extends java.lang.Object

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.


Constructor Summary
RouteSpecificPool(HttpRoute r)
          Creates a new route-specific pool.
 
Method Summary
 BasicPoolEntry allocEntry()
          Obtains a free entry from this pool, if one is available.
 void createdEntry(BasicPoolEntry entry)
          Indicates creation of an entry for this pool.
 boolean deleteEntry(BasicPoolEntry entry)
          Deletes an entry from this pool.
 void dropEntry()
          Forgets about an entry from this pool.
 void freeEntry(BasicPoolEntry entry)
          Returns an allocated entry to this pool.
 int getEntryCount()
          Obtains the number of entries.
 HttpRoute getRoute()
          Obtains the route for which this pool is specific.
 boolean isUnused()
          Indicates whether this pool is unused.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RouteSpecificPool

public RouteSpecificPool(HttpRoute r)
Creates a new route-specific pool.

Parameters:
r - the route for which to pool
Method Detail

getRoute

public final HttpRoute getRoute()
Obtains the route for which this pool is specific.

Returns:
the route

isUnused

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:
true if this pool is unused, false otherwise

getEntryCount

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:
the number of entries for the route of this pool

allocEntry

public BasicPoolEntry allocEntry()
Obtains a free entry from this pool, if one is available.

Returns:
an available pool entry, or null if there is none

freeEntry

public void freeEntry(BasicPoolEntry entry)
Returns an allocated entry to this pool.

Parameters:
entry - the entry obtained from allocEntry or presented to createdEntry

createdEntry

public void createdEntry(BasicPoolEntry entry)
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 - the entry that was created for this pool

deleteEntry

public boolean deleteEntry(BasicPoolEntry entry)
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 - the entry to delete from this pool
Returns:
true if the entry was found and deleted, or false if the entry was not found

dropEntry

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.



Copyright © 2000-2007 Apache Software Foundation. All Rights Reserved.