net.spy.pool
Class PoolContainer

java.lang.Object
  extended bynet.spy.pool.PoolContainer

public class PoolContainer
extends Object

PoolContainer is the storage for a given pool.


Constructor Summary
PoolContainer(String name, PoolFiller pf)
          Create a new PoolContainer for a pool with a given name, and filler.
PoolContainer(String name, PoolFiller pf, SpyConfig conf)
          Create a new PoolContainer for a pool with a given name, and filler.
 
Method Summary
 int availableObjects()
          Find out how many objects are available in this pool.
 String getName()
          Get the name of the pool.
 PooledObject getObject()
          Get an object from the pool.
 void prune()
          Remove any object that is not checked out, as long as we stay above our minimum object requirement.
 String toString()
          debugging tool, dump out the current state of the pool
 int totalObjects()
          Find out how many objects are in this pool.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PoolContainer

public PoolContainer(String name,
                     PoolFiller pf,
                     SpyConfig conf)
              throws PoolException
Create a new PoolContainer for a pool with a given name, and filler. The following optional config parameters will be used:

PoolContainer

public PoolContainer(String name,
                     PoolFiller pf)
              throws PoolException
Create a new PoolContainer for a pool with a given name, and filler. The following optional config parameters will be used:
Method Detail

getName

public String getName()
Get the name of the pool.


getObject

public PooledObject getObject()
                       throws PoolException
Get an object from the pool. It could take up to about three seconds to get an object from the pool.

Throws:
PoolException - when something bad happens

toString

public String toString()
debugging tool, dump out the current state of the pool


availableObjects

public int availableObjects()
Find out how many objects are available in this pool.

Returns:
the number of available (not checked out) objects.

prune

public void prune()
           throws PoolException
Remove any object that is not checked out, as long as we stay above our minimum object requirement.

This method should only be called from the ObjectPoolCleaner -- please don't call it directly.

Throws:
PoolException - when something bad happens

totalObjects

public int totalObjects()
Find out how many objects are in this pool. This will be the sum of the available and unavailable objects.