Package org.apache.xml.utils
Class ObjectPool
- java.lang.Object
-
- org.apache.xml.utils.ObjectPool
-
- All Implemented Interfaces:
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- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ObjectPool()
Constructor ObjectPoolObjectPool(java.lang.Class type)
Constructor ObjectPoolObjectPool(java.lang.Class type, int size)
Constructor ObjectPoolObjectPool(java.lang.String className)
Constructor ObjectPool
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
freeInstance(java.lang.Object obj)
Add an instance of the given object to the pooljava.lang.Object
getInstance()
Get an instance of the given object in this pooljava.lang.Object
getInstanceIfFree()
Get an instance of the given object in this pool if available
-
-
-
Constructor Detail
-
ObjectPool
public ObjectPool(java.lang.Class type)
Constructor ObjectPool- Parameters:
type
- Type of objects for this pool
-
ObjectPool
public ObjectPool(java.lang.String className)
Constructor ObjectPool- Parameters:
className
- Fully qualified name of the type of objects for this pool.
-
ObjectPool
public ObjectPool(java.lang.Class type, int size)
Constructor ObjectPool- Parameters:
type
- Type of objects for this poolsize
- Size of vector to allocate
-
ObjectPool
public ObjectPool()
Constructor ObjectPool
-
-
Method Detail
-
getInstanceIfFree
public java.lang.Object getInstanceIfFree()
Get an instance of the given object in this pool if available- Returns:
- an instance of the given object if available or null
-
getInstance
public java.lang.Object getInstance()
Get an instance of the given object in this pool- Returns:
- An instance of the given object
-
freeInstance
public void freeInstance(java.lang.Object obj)
Add an instance of the given object to the pool- Parameters:
obj
- Object to add.
-
-