org.apache.avalon.excalibur.pool
Class SingleThreadedPool
java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.apache.avalon.excalibur.pool.SingleThreadedPool
- All Implemented Interfaces:
- Disposable, Initializable, LogEnabled, Pool, Resizable, SingleThreaded
- public class SingleThreadedPool
- extends AbstractLogEnabled
- implements Pool, Initializable, SingleThreaded, Resizable, Disposable
This is an Pool that caches Poolable objects for reuse.
- Since:
- 4.0
- Version:
- CVS $Revision: 1.6 $ $Date: 2004/03/29 16:50:37 $
- Author:
| Method Summary |
void |
dispose()
Dispose the pool and decommission any Poolables. |
void |
fill(int fillSize)
This fills the pool to the size specified in parameter. |
Poolable |
get()
Retrieve an object from pool. |
int |
getCapacity()
Return the total number of slots in Pool |
void |
grow(int increase)
This fills the pool by the size specified in parameter. |
void |
initialize()
Initialize the component. |
void |
put(Poolable poolable)
Place an object in pool. |
void |
shrink(int decrease)
This shrinks the pool by parameter size. |
int |
size()
Get the number of used slots in Pool |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
m_initialized
protected boolean m_initialized
-
m_count
protected int m_count
-
m_pool
protected Poolable[] m_pool
-
m_factory
protected ObjectFactory m_factory
-
m_controller
protected PoolController m_controller
-
m_maximum
protected int m_maximum
-
m_initial
protected int m_initial
-
SingleThreadedPool
public SingleThreadedPool(java.lang.Class clazz,
int initial,
int maximum)
throws java.lang.Exception
SingleThreadedPool
public SingleThreadedPool(ObjectFactory factory,
int initial,
int maximum)
throws java.lang.Exception
SingleThreadedPool
public SingleThreadedPool(ObjectFactory factory,
PoolController controller,
int initial,
int maximum)
throws java.lang.Exception
initialize
public void initialize()
throws java.lang.Exception
- Description copied from interface:
Initializable
-
Initialize the component. Initialization includes allocating any resources required throughout the component's lifecycle.
-
- Specified by:
initialize in interface Initializable
-
- Throws:
java.lang.Exception - if an error occurs
get
public Poolable get()
throws java.lang.Exception
-
Retrieve an object from pool.
-
- Specified by:
get in interface Pool
-
- Returns:
- an object from Pool
- Throws:
java.lang.Exception
put
public void put(Poolable poolable)
-
Place an object in pool.
-
- Specified by:
put in interface Pool
-
- Parameters:
poolable - the object to be placed in pool
getCapacity
public final int getCapacity()
-
Return the total number of slots in Pool
-
-
- Returns:
- the total number of slots
size
public final int size()
-
Get the number of used slots in Pool
-
-
- Returns:
- the number of used slots
fill
public final void fill(int fillSize)
throws java.lang.Exception
-
This fills the pool to the size specified in parameter.
-
-
- Throws:
java.lang.Exception
grow
public final void grow(int increase)
-
This fills the pool by the size specified in parameter.
-
- Specified by:
grow in interface Resizable
-
shrink
public final void shrink(int decrease)
-
This shrinks the pool by parameter size.
-
- Specified by:
shrink in interface Resizable
-
dispose
public void dispose()
-
Dispose the pool and decommission any Poolables.
-
- Specified by:
dispose in interface Disposable
-
Please see keelframework.org for information about new Keel releases.