public class ConstantPoolStrategy extends java.lang.Object implements IPoolStrategy
| Modifier and Type | Field and Description |
|---|---|
protected int |
capacity
The number of free workers.
|
protected int |
workercnt
The number of workers in the pool.
|
| Constructor and Description |
|---|
ConstantPoolStrategy()
Create a new ConstantPoolStrategy.
|
ConstantPoolStrategy(int workercnt)
Create a new ConstantPoolStrategy.
|
| Modifier and Type | Method and Description |
|---|---|
int |
getCapacity()
Get the number of free workers.
|
int |
getWorkerCount()
Get the worker cnt.
|
long |
getWorkerTimeout()
Get the component timeout.
|
boolean |
taskAdded()
Called when a new task was added to the pool.
|
boolean |
taskFinished()
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 |
workerTimeoutOccurred()
Notify the strategy that a timeout for a component has occurred,
i.e.
|
protected int workercnt
protected int capacity
public ConstantPoolStrategy()
public ConstantPoolStrategy(int workercnt)
public boolean taskAdded()
taskAdded in interface IPoolStrategypublic void workersAdded(int cnt)
workersAdded in interface IPoolStrategycnt - The number of new workers.public void taskServed(long waitdur)
taskServed in interface IPoolStrategywaitdur - The waiting time of the task.public boolean taskFinished()
taskFinished in interface IPoolStrategypublic long getWorkerTimeout()
getWorkerTimeout in interface IPoolStrategypublic boolean workerTimeoutOccurred()
workerTimeoutOccurred in interface IPoolStrategypublic int getWorkerCount()
getWorkerCount in interface IPoolStrategypublic int getCapacity()
getCapacity in interface IPoolStrategy