nl.knowledgeplaza.util.pool
Class PriorityObjectPool<T>

java.lang.Object
  extended by nl.knowledgeplaza.util.pool.BaseObjectPool<T>
      extended by nl.knowledgeplaza.util.pool.PriorityObjectPool<T>
All Implemented Interfaces:
ObjectPool<T>
Direct Known Subclasses:
FastestFirstObjectPool

public class PriorityObjectPool<T>
extends BaseObjectPool<T>
implements ObjectPool<T>

This class implements a priority pool. This means that the pooled objects are sorted according to criteria implemented by a Comparator.

Version:
$Revision: 1.3 $
Author:
$Author: toeukpap $
See Also:

Nested Class Summary
 
Nested classes/interfaces inherited from class nl.knowledgeplaza.util.pool.BaseObjectPool
BaseObjectPool.NotFromThisPoolException, BaseObjectPool.TimeOutException
 
Field Summary
protected  List<T> iListOfPooledObjects
           
protected  SortedList<T> iSortedListOfPooledObjects
          the storage
static String SOURCECODE_VERSION
          Standard variable for determining version of a class file.
 
Fields inherited from class nl.knowledgeplaza.util.pool.BaseObjectPool
iClose, iListOfHandedOutObjects, iListOfHandedOutObjectsSync, iShuttingDown, iSynchronized, itestOnBorrow, MAINTENANCE_PERIOD, WHEN_EXHAUSTED_BLOCK, WHEN_EXHAUSTED_FAIL
 
Constructor Summary
PriorityObjectPool()
          Initialize Assume that the pooled objects are Comparable
PriorityObjectPool(Collection<T> collection)
          Initialize Assume that the pooled objects are Comparable
PriorityObjectPool(Collection<T> collection, Comparator<T> comparator)
          Initialize
PriorityObjectPool(Comparator<T> comparator)
          Initialize
PriorityObjectPool(PoolableObjectFactory<T> poolableObjectFactory)
          Initialize Assume that the pooled objects are Comparable
PriorityObjectPool(PoolableObjectFactory<T> poolableObjectFactory, Comparator<T> comparator)
          Initialize
 
Method Summary
protected  Collection<T> getPooledObjectsImpl()
          this method allows read only access to the collection of handed out objects, used by the generic algorithm
protected  T obtainPooledObjectImpl()
          this method obtains a pooled object, the implementation determines the behaviour (LIFO, FIFO, etc)
protected  void returnPooledObjectImpl(T o)
          this method returns a pooled object, the implementation determines the behaviour (LIFO, FIFO, etc)
 
Methods inherited from class nl.knowledgeplaza.util.pool.BaseObjectPool
addObject, borrowObject, clear, close, factoryActivateObject, factoryDestroyObject, factoryMakeObject, factoryPassivateObject, factoryValidateObject, fill, getFactory, getMaxActive, getMaxIdle, getMaxWait, getName, getNameDescription, getNumActive, getNumberOfObjectsScheduledForDestruction, getNumIdle, getPooledObjects, getTestOnBorrow, getWhenExhaustedAction, invalidateObject, isClosed, isShuttingDown, isSynchronized, maintenance, obtainPooledObject, returnObject, returnPooledObject, setFactory, setMaxActive, setMaxIdle, setMaxWait, setName, setSynchronized, setTestOnBorrow, setWhenExhaustedAction, shutdown
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface nl.knowledgeplaza.util.pool.ObjectPool
addObject, borrowObject, clear, close, getNumActive, getNumIdle, invalidateObject, isSynchronized, returnObject, setFactory, setSynchronized, shutdown
 

Field Detail

SOURCECODE_VERSION

public static final String SOURCECODE_VERSION
Standard variable for determining version of a class file.

See Also:
Constant Field Values

iSortedListOfPooledObjects

protected SortedList<T> iSortedListOfPooledObjects
the storage


iListOfPooledObjects

protected List<T> iListOfPooledObjects
Constructor Detail

PriorityObjectPool

public PriorityObjectPool()
Initialize Assume that the pooled objects are Comparable


PriorityObjectPool

public PriorityObjectPool(Comparator<T> comparator)
Initialize


PriorityObjectPool

public PriorityObjectPool(PoolableObjectFactory<T> poolableObjectFactory)
Initialize Assume that the pooled objects are Comparable


PriorityObjectPool

public PriorityObjectPool(PoolableObjectFactory<T> poolableObjectFactory,
                          Comparator<T> comparator)
Initialize


PriorityObjectPool

public PriorityObjectPool(Collection<T> collection)
Initialize Assume that the pooled objects are Comparable


PriorityObjectPool

public PriorityObjectPool(Collection<T> collection,
                          Comparator<T> comparator)
Initialize

Method Detail

getPooledObjectsImpl

protected Collection<T> getPooledObjectsImpl()
Description copied from class: BaseObjectPool
this method allows read only access to the collection of handed out objects, used by the generic algorithm

Specified by:
getPooledObjectsImpl in class BaseObjectPool<T>

obtainPooledObjectImpl

protected T obtainPooledObjectImpl()
Description copied from class: BaseObjectPool
this method obtains a pooled object, the implementation determines the behaviour (LIFO, FIFO, etc)

Specified by:
obtainPooledObjectImpl in class BaseObjectPool<T>

returnPooledObjectImpl

protected void returnPooledObjectImpl(T o)
Description copied from class: BaseObjectPool
this method returns a pooled object, the implementation determines the behaviour (LIFO, FIFO, etc)

Specified by:
returnPooledObjectImpl in class BaseObjectPool<T>


Copyright © 2012 KnowledgePlaza. All Rights Reserved.