nl.knowledgeplaza.util.pool
Class CollectionObjectPoolFactory

java.lang.Object
  extended by 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 $

Field Summary
protected  boolean iRecycleObjects
           
static java.lang.String SOURCECODE_VERSION
          Standard variable for determining version of a class file.
 
Constructor Summary
CollectionObjectPoolFactory(java.util.Collection data)
           
CollectionObjectPoolFactory(java.util.Collection data, boolean recycle)
           
 
Method Summary
 void activateObject(java.lang.Object arg0)
           
 void destroyObject(java.lang.Object arg0)
          if RecycleObjects = true, objects are added back to the list
 boolean getRecycleObjects()
           
 java.lang.Object makeObject()
           
 void passivateObject(java.lang.Object arg0)
           
 void setRecycleObjects(boolean value)
          RecycleObjects
 boolean validateObject(java.lang.Object arg0)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

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
Constructor Detail

CollectionObjectPoolFactory

public CollectionObjectPoolFactory(java.util.Collection data)
Parameters:
data -

CollectionObjectPoolFactory

public CollectionObjectPoolFactory(java.util.Collection data,
                                   boolean recycle)
Parameters:
data -
recycle -
Method Detail

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. All Rights Reserved.