|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnl.knowledgeplaza.util.pool.BaseObjectPool<T>
nl.knowledgeplaza.util.pool.PriorityObjectPool<T>
nl.knowledgeplaza.util.pool.FastestFirstObjectPool<T>
public class FastestFirstObjectPool<T>
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 Map<T,nl.knowledgeplaza.util.pool.FastestFirstObjectPool.AverageData> |
iAverageData
|
static String |
SOURCECODE_VERSION
Standard variable for determining version of a class file. |
| Fields inherited from class nl.knowledgeplaza.util.pool.PriorityObjectPool |
|---|
iListOfPooledObjects, iSortedListOfPooledObjects |
| 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(Collection<T> collection,
Comparator<T> comparator)
Initialize |
|
FastestFirstObjectPool(PoolableObjectFactory<T> poolableObjectFactory)
Initialize |
|
| Method Summary | |
|---|---|
void |
factoryDestroyObject(T object)
Clean up the statistical data |
int |
getMinimumNumberOfMeasurements()
MinimumNumberOfMeasurements |
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) |
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 String SOURCECODE_VERSION
protected Map<T,nl.knowledgeplaza.util.pool.FastestFirstObjectPool.AverageData> iAverageData
| Constructor Detail |
|---|
public FastestFirstObjectPool()
public FastestFirstObjectPool(PoolableObjectFactory<T> poolableObjectFactory)
public FastestFirstObjectPool(Collection<T> collection,
Comparator<T> comparator)
| Method Detail |
|---|
public int getMinimumNumberOfMeasurements()
public void setMinimumNumberOfMeasurements(int value)
protected T obtainPooledObjectImpl()
BaseObjectPool
obtainPooledObjectImpl in class PriorityObjectPool<T>protected void returnPooledObjectImpl(T o)
BaseObjectPool
returnPooledObjectImpl in class PriorityObjectPool<T>public void factoryDestroyObject(T object)
factoryDestroyObject in class BaseObjectPool<T>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||