Package jadex.commons
Class ConstantPoolStrategy
- java.lang.Object
- 
- jadex.commons.ConstantPoolStrategy
 
- 
- All Implemented Interfaces:
- IPoolStrategy
 
 public class ConstantPoolStrategy extends java.lang.Object implements IPoolStrategy Simple strategy with a constant number of workers.
- 
- 
Constructor SummaryConstructors Constructor Description ConstantPoolStrategy()Create a new ConstantPoolStrategy.ConstantPoolStrategy(int workercnt)Create a new ConstantPoolStrategy.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetCapacity()Get the number of free workers.intgetWorkerCount()Get the worker cnt.longgetWorkerTimeout()Get the component timeout.booleantaskAdded()Called when a new task was added to the pool.booleantaskFinished()Called when a task is finished.voidtaskServed(long waitdur)Called when a new task was served from the pool.voidworkersAdded(int cnt)Called when a new worker was added proactively to the pool.booleanworkerTimeoutOccurred()Notify the strategy that a timeout for a component has occurred, i.e.
 
- 
- 
- 
Method Detail- 
taskAddedpublic boolean taskAdded() Called when a new task was added to the pool.- Specified by:
- taskAddedin interface- IPoolStrategy
- Returns:
- True, if a new worker should be added to the pool.
 
 - 
workersAddedpublic void workersAdded(int cnt) Called when a new worker was added proactively to the pool.- Specified by:
- workersAddedin interface- IPoolStrategy
- Parameters:
- cnt- The number of new workers.
 
 - 
taskServedpublic void taskServed(long waitdur) Called when a new task was served from the pool.- Specified by:
- taskServedin interface- IPoolStrategy
- Parameters:
- waitdur- The waiting time of the task.
 
 - 
taskFinishedpublic boolean taskFinished() Called when a task is finished.- Specified by:
- taskFinishedin interface- IPoolStrategy
- Returns:
- True, if executing worker should be removed from the pool.
 
 - 
getWorkerTimeoutpublic long getWorkerTimeout() Get the component timeout.- Specified by:
- getWorkerTimeoutin interface- IPoolStrategy
- Returns:
- The timeout for the component to wait for new workers in the pool.
 
 - 
workerTimeoutOccurredpublic boolean workerTimeoutOccurred() Notify the strategy that a timeout for a component has occurred, i.e. it was not needed for serving some worker.- Specified by:
- workerTimeoutOccurredin interface- IPoolStrategy
- Returns:
- True, if the component be excluded from the pool.
 
 - 
getWorkerCountpublic int getWorkerCount() Get the worker cnt.- Specified by:
- getWorkerCountin interface- IPoolStrategy
 
 - 
getCapacitypublic int getCapacity() Get the number of free workers.- Specified by:
- getCapacityin interface- IPoolStrategy
 
 
- 
 
-