|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnl.knowledgeplaza.util.pool.BaseObjectPool
nl.knowledgeplaza.util.pool.PriorityObjectPool
nl.knowledgeplaza.util.pool.FastestFirstObjectPool
public class FastestFirstObjectPool
This class implements a priority pool based on the assumption that all pooled objects are the same but not identical. This means they can all do the same work, but maybe not equally fast. It is assumed that all pooled objects on average get to process identical tasks, or workload. Because of this unequality, some pooled objects will perform the workload faster than others. This object pool will hand out the faster pooled objects before the slower. Faster is determine by keeping statistical data on how long it takes to perform the workload. Over time this should flatten out into a correct representation. The implementation tries to do its work with as less objects as possible (stack alike), unused objects have a very high average which puts them at the end of the priority queue.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class nl.knowledgeplaza.util.pool.BaseObjectPool |
|---|
BaseObjectPool.NotFromThisPoolException, BaseObjectPool.TimeOutException |
| Field Summary | |
|---|---|
protected java.util.Map |
iAverageData
|
static java.lang.String |
SOURCECODE_VERSION
Standard variable for determining version of a class file. |
| Fields inherited from class nl.knowledgeplaza.util.pool.PriorityObjectPool |
|---|
iListOfPooledObjects |
| 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 | |
|---|---|
FastestFirstObjectPool()
Initialize Assume that the pooled objects are Comparable |
|
FastestFirstObjectPool(java.util.Collection collection,
java.util.Comparator comparator)
Initialize |
|
FastestFirstObjectPool(PoolableObjectFactory poolableObjectFactory)
Initialize |
|
| Method Summary | |
|---|---|
void |
factoryDestroyObject(java.lang.Object object)
Clean up the statistical data |
int |
getMinimumNumberOfMeasurements()
MinimumNumberOfMeasurements |
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) |
void |
setMinimumNumberOfMeasurements(int value)
|
| Methods inherited from class nl.knowledgeplaza.util.pool.PriorityObjectPool |
|---|
getPooledObjectsImpl |
| 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 |
|---|
public static final java.lang.String SOURCECODE_VERSION
protected java.util.Map iAverageData
| Constructor Detail |
|---|
public FastestFirstObjectPool()
public FastestFirstObjectPool(PoolableObjectFactory poolableObjectFactory)
public FastestFirstObjectPool(java.util.Collection collection,
java.util.Comparator comparator)
| Method Detail |
|---|
public int getMinimumNumberOfMeasurements()
public void setMinimumNumberOfMeasurements(int value)
protected java.lang.Object obtainPooledObjectImpl()
BaseObjectPool
obtainPooledObjectImpl in class PriorityObjectPoolprotected void returnPooledObjectImpl(java.lang.Object o)
BaseObjectPool
returnPooledObjectImpl in class PriorityObjectPoolpublic void factoryDestroyObject(java.lang.Object object)
factoryDestroyObject in class BaseObjectPool
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||