nl.knowledgeplaza.util.pool
Class CollectionObjectPoolFactory
java.lang.Object
nl.knowledgeplaza.util.pool.CollectionObjectPoolFactory
- All Implemented Interfaces:
- PoolableObjectFactory
public class CollectionObjectPoolFactory
- extends java.lang.Object
- implements PoolableObjectFactory
This class is a simple implementation of an ObjectPoolFactory.
A new instance of this class is provided with a list of values that are pooled.
The instance can be handed over to a StackObjectPool or a RoundRobinObjectPool to provide pooling behaviour.
Making a new object means that one object is removed from the list and handed over to the pool to be managed.
If the list is empty, null will be returned. It is up to the pool to decide if it will then wait or abort.
Objects are always considered valid, and no action is take to activate or destroy them. These methods can be overridden.
Destroyed objects are added back to the list if RecycleObjects = true.
- Version:
- $Revision: 1.2 $
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SOURCECODE_VERSION
public static final java.lang.String SOURCECODE_VERSION
- Standard variable for determining version of a class file.
- See Also:
- Constant Field Values
iRecycleObjects
protected boolean iRecycleObjects
CollectionObjectPoolFactory
public CollectionObjectPoolFactory(java.util.Collection data)
- Parameters:
data -
CollectionObjectPoolFactory
public CollectionObjectPoolFactory(java.util.Collection data,
boolean recycle)
- Parameters:
data - recycle -
setRecycleObjects
public void setRecycleObjects(boolean value)
- RecycleObjects
getRecycleObjects
public boolean getRecycleObjects()
makeObject
public java.lang.Object makeObject()
- Specified by:
makeObject in interface PoolableObjectFactory
validateObject
public boolean validateObject(java.lang.Object arg0)
- Specified by:
validateObject in interface PoolableObjectFactory
activateObject
public void activateObject(java.lang.Object arg0)
- Specified by:
activateObject in interface PoolableObjectFactory
passivateObject
public void passivateObject(java.lang.Object arg0)
- Specified by:
passivateObject in interface PoolableObjectFactory
destroyObject
public void destroyObject(java.lang.Object arg0)
- if RecycleObjects = true, objects are added back to the list
- Specified by:
destroyObject in interface PoolableObjectFactory
Copyright © 2010 KnowledgePlaza. All Rights Reserved.