Package org.apache.xml.utils
Class ObjectPool
java.lang.Object
org.apache.xml.utils.ObjectPool
- All Implemented Interfaces:
Serializable
Pool of object of a given type to pick from to help memory usage
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor ObjectPoolObjectPool
(Class type) Constructor ObjectPoolObjectPool
(Class type, int size) Constructor ObjectPoolObjectPool
(String className) Constructor ObjectPool -
Method Summary
Modifier and TypeMethodDescriptionvoid
freeInstance
(Object obj) Add an instance of the given object to the poolGet an instance of the given object in this poolGet an instance of the given object in this pool if available
-
Constructor Details
-
ObjectPool
Constructor ObjectPool- Parameters:
type
- Type of objects for this pool
-
ObjectPool
Constructor ObjectPool- Parameters:
className
- Fully qualified name of the type of objects for this pool.
-
ObjectPool
Constructor ObjectPool- Parameters:
type
- Type of objects for this poolsize
- Size of vector to allocate
-
ObjectPool
public ObjectPool()Constructor ObjectPool
-
-
Method Details
-
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
Get an instance of the given object in this pool- Returns:
- An instance of the given object
-
freeInstance
Add an instance of the given object to the pool- Parameters:
obj
- Object to add.
-