Package jadex.common
Interface IPoolStrategy
- All Known Implementing Classes:
ConstantPoolStrategy
,DefaultPoolStrategy
public interface IPoolStrategy
Interface for pool strategies.
-
Method Summary
Modifier and TypeMethodDescriptionint
Get the number of free workers.int
Get the worker cnt.long
Get the component timeout.boolean
Called when a new task was added to the pool.boolean
Called when a task is finished.void
taskServed
(long waitdur) Called when a new task was served from the pool.void
workersAdded
(int cnt) Called when a new worker was added proactively to the pool.boolean
Notify the strategy that a timeout for a worker component has occurred, i.e.
-
Method Details
-
taskAdded
boolean taskAdded()Called when a new task was added to the pool.- Returns:
- True, if a new worker should be added to the pool.
-
taskServed
void taskServed(long waitdur) Called when a new task was served from the pool.- Parameters:
waitdur
- The waiting time of the task.
-
taskFinished
boolean taskFinished()Called when a task is finished.- Returns:
- True, if executing worker should be removed from the pool.
-
workersAdded
void workersAdded(int cnt) Called when a new worker was added proactively to the pool. Workers are automatically removed by the strategy as result of taskFinished().- Parameters:
cnt
- The number of new workers.
-
getWorkerTimeout
long getWorkerTimeout()Get the component timeout.- Returns:
- The timeout for the component to wait for new workers in the pool.
-
workerTimeoutOccurred
boolean workerTimeoutOccurred()Notify the strategy that a timeout for a worker component has occurred, i.e. it was not needed for serving some worker.- Returns:
- True, if the component be excluded from the pool.
-
getWorkerCount
int getWorkerCount()Get the worker cnt. -
getCapacity
int getCapacity()Get the number of free workers.
-