nl.knowledgeplaza.util.pool
Class PriorityObjectPool

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

public class PriorityObjectPool
extends BaseObjectPool
implements ObjectPool

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

Version:
$Revision: 1.2 $
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  SortedList iListOfPooledObjects
          the storage
static java.lang.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(java.util.Collection collection)
          Initialize Assume that the pooled objects are Comparable
PriorityObjectPool(java.util.Collection collection, java.util.Comparator comparator)
          Initialize
PriorityObjectPool(java.util.Comparator comparator)
          Initialize
PriorityObjectPool(PoolableObjectFactory poolableObjectFactory)
          Initialize Assume that the pooled objects are Comparable
PriorityObjectPool(PoolableObjectFactory poolableObjectFactory, java.util.Comparator comparator)
          Initialize
 
Method Summary
protected  java.util.Collection getPooledObjectsImpl()
          this method allows read only access to the collection of handed out objects, used by the generic algorithm
protected  java.lang.Object obtainPooledObjectImpl()
          this method obtains a pooled object, the implementation determines the behaviour (LIFO, FIFO, etc)
protected  void returnPooledObjectImpl(java.lang.Object 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 java.lang.String SOURCECODE_VERSION
Standard variable for determining version of a class file.

See Also:
Constant Field Values

iListOfPooledObjects

protected SortedList iListOfPooledObjects
the storage

Constructor Detail

PriorityObjectPool

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


PriorityObjectPool

public PriorityObjectPool(java.util.Comparator comparator)
Initialize


PriorityObjectPool

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


PriorityObjectPool

public PriorityObjectPool(PoolableObjectFactory poolableObjectFactory,
                          java.util.Comparator comparator)
Initialize


PriorityObjectPool

public PriorityObjectPool(java.util.Collection collection)
Initialize Assume that the pooled objects are Comparable


PriorityObjectPool

public PriorityObjectPool(java.util.Collection collection,
                          java.util.Comparator comparator)
Initialize

Method Detail

getPooledObjectsImpl

protected java.util.Collection 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

obtainPooledObjectImpl

protected java.lang.Object 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

returnPooledObjectImpl

protected void returnPooledObjectImpl(java.lang.Object 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


Copyright © 2010 KnowledgePlaza. All Rights Reserved.