|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface Pool
Pool extends ObjectFactory by adding support to pool instantiated objects. When a new instance is requested, the factory first checks its pool if one is available. If the the pool is empty, a new object will be instantiated from the specified class. If only class name is given, the request to create an instance will be forwarded to the specified Factory.
For objects implementing the Recyclable interface, a recycle method will be called, when they are taken from the pool, and a dispose method, when they are returned to the pool.
| Field Summary | |
|---|---|
static int |
DEFAULT_POOL_CAPACITY
The default pool capacity. |
| Method Summary | |
|---|---|
void |
clearPool()
Clears all instances from the pool. |
void |
clearPool(String className)
Clears instances of a named class from the pool. |
int |
getCapacity()
Gets the default capacity of the pool. |
int |
getCapacity(String className)
Gets the capacity of the pool for a named class. |
ObjectName |
getFactoryName()
Gets the factory of this pool. |
Object |
getInstance(Class clazz)
Gets an instance of a specified class either from the pool or by instatiating from the class if the pool is empty. |
Object |
getInstance(Class clazz,
Object[] params,
String[] signature)
Gets an instance of a specified class either from the pool or by instatiating from the class if the pool is empty. |
int |
getSize(String className)
Gets the current size of the pool for a named class. |
boolean |
putInstance(Object instance)
Puts a used object back to the pool. |
void |
setCapacity(int capacity)
Sets the default capacity of the pool. |
void |
setCapacity(String className,
int capacity)
Sets the capacity of the pool for a named class. |
void |
setFactoryName(ObjectName factory)
Sets the factory of this pool. |
| Methods inherited from interface org.norther.tammi.core.base.ObjectFactory |
|---|
getInstance, getInstance, getInstance, getInstance, isLoaderSupported |
| Field Detail |
|---|
static final int DEFAULT_POOL_CAPACITY
| Method Detail |
|---|
Object getInstance(Class clazz)
throws ConstructionException
clazz - the class.
ConstructionException - if recycling fails.
Object getInstance(Class clazz,
Object[] params,
String[] signature)
throws ConstructionException
clazz - the class.params - an array containing the parameters of the constructor.signature - an array containing the signature of the constructor.
ConstructionException - if recycling fails.boolean putInstance(Object instance)
instance - the object instance to recycle.
int getCapacity()
void setCapacity(int capacity)
capacity - the new capacity.int getCapacity(String className)
className - the name of the class.
void setCapacity(String className,
int capacity)
className - the name of the class.capacity - the new capacity.int getSize(String className)
className - the name of the class.
void clearPool(String className)
className - the name of the class.void clearPool()
ObjectName getFactoryName()
void setFactoryName(ObjectName factory)
factory - the object name of the factory or a query.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||