org.apache.xml.utils
Class ObjectPool
java.lang.Object
org.apache.xml.utils.ObjectPool
- java.io.Serializable
public class ObjectPool
extends java.lang.Object
implements java.io.Serializable
Pool of object of a given type to pick from to help memory usage
- Serialized Form
void | freeInstance(Object obj) - Add an instance of the given object to the pool
|
Object | getInstance() - Get an instance of the given object in this pool
|
Object | getInstanceIfFree() - Get an instance of the given object in this pool if available
|
ObjectPool
public ObjectPool()
Constructor ObjectPool
ObjectPool
public ObjectPool(Class type)
Constructor ObjectPool
type
- Type of objects for this pool
ObjectPool
public ObjectPool(Class type,
int size)
Constructor ObjectPool
type
- Type of objects for this poolsize
- Size of vector to allocate
ObjectPool
public ObjectPool(String className)
Constructor ObjectPool
className
- Fully qualified name of the type of objects for this pool.
freeInstance
public void freeInstance(Object obj)
Add an instance of the given object to the pool
obj
- Object to add.
getInstance
public Object getInstance()
Get an instance of the given object in this pool
- An instance of the given object
getInstanceIfFree
public Object getInstanceIfFree()
Get an instance of the given object in this pool if available
- an instance of the given object if available or null
Copyright B) 2004 Apache XML Project. All Rights Reserved.