org.apache.avalon.excalibur.pool
Class SingleThreadedPool
java.lang.Object
|
+--org.apache.avalon.excalibur.pool.SingleThreadedPool
- All Implemented Interfaces:
- Component, Pool, Resizable, SingleThreaded
- public class SingleThreadedPool
- extends java.lang.Object
- implements Pool, SingleThreaded, Resizable
This is an Pool
that caches Poolable objects for reuse.
- Version:
- CVS $Revision: 1.3 $ $Date: 2001/06/01 21:09:29 $
- Author:
- Berin Loritsch, Stefano Mazzocchi, Peter Donald
Method Summary |
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 |
int |
getSize()
Get the number of used slots in Pool |
void |
grow(int increase)
This fills the pool by the size specified in parameter. |
void |
initialize()
|
void |
put(Poolable poolable)
Place an object in pool. |
void |
shrink(int decrease)
This shrinks the pool by parameter size. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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(ObjectFactory factory,
PoolController controller,
int initial,
int maximum)
throws java.lang.Exception
initialize
public void initialize()
throws java.lang.Exception
get
public Poolable get()
throws java.lang.Exception
- Retrieve an object from pool.
- Specified by:
get
in interface Pool
- Returns:
- an object from Pool
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
getSize
public final int getSize()
- 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.
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
Copyright © 2001 Apache Jakarta Project. All Rights Reserved.