public class DefaultPoolStrategy extends Object implements IPoolStrategy
Constructor and Description |
---|
DefaultPoolStrategy()
Create a new default pool strategy.
|
DefaultPoolStrategy(int desfree,
int maxcnt)
Create a new default pool strategy.
|
DefaultPoolStrategy(int workercnt,
int desfree,
long maxwait,
int maxcnt)
Create a new default pool strategy.
|
DefaultPoolStrategy(int workercnt,
int desfree,
long maxwait,
int maxcnt,
boolean defer)
Create a new default pool strategy.
|
DefaultPoolStrategy(int workercnt,
int desfree,
long maxwait,
int maxcnt,
boolean deferinc,
boolean deferdec)
Create a new default pool strategy.
|
DefaultPoolStrategy(int desfree,
long maxwait,
int maxcnt)
Create a new default pool strategy.
|
Modifier and Type | Method and Description |
---|---|
int |
getCapacity()
Get the capacity.
|
int |
getDesiredFree()
Get the desfree.
|
int |
getMaxCount()
Get the max cnt.
|
long |
getMaxWait()
Get the maxwait.
|
int |
getWorkerCount()
Get the worker cnt.
|
long |
getWorkerTimeout()
Get the worker timeout.
|
void |
setCapacity(int capacity)
Set the capacity.
|
void |
setDesiredFree(int desfree)
Set the desfree.
|
void |
setMaxCount(int maxcnt)
Set the max cnt.
|
void |
setMaxWait(long maxwait)
Set the maxwait.
|
void |
setWorkerCount(int workercnt)
Set the worker cnt.
|
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.
|
String |
toString()
Get the string representation.
|
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 worker has occurred,
i.e. it was not needed for serving some task.
|
public DefaultPoolStrategy()
public DefaultPoolStrategy(int desfree, int maxcnt)
public DefaultPoolStrategy(int desfree, long maxwait, int maxcnt)
public DefaultPoolStrategy(int workercnt, int desfree, long maxwait, int maxcnt)
public DefaultPoolStrategy(int workercnt, int desfree, long maxwait, int maxcnt, boolean defer)
public DefaultPoolStrategy(int workercnt, int desfree, long maxwait, int maxcnt, boolean deferinc, boolean deferdec)
public boolean taskAdded()
taskAdded
in interface IPoolStrategy
public void workersAdded(int cnt)
workersAdded
in interface IPoolStrategy
cnt
- The number of new workers.public void taskServed(long waitdur)
taskServed
in interface IPoolStrategy
waitdur
- The waiting time of the task.public boolean taskFinished()
taskFinished
in interface IPoolStrategy
public long getWorkerTimeout()
getWorkerTimeout
in interface IPoolStrategy
public boolean workerTimeoutOccurred()
workerTimeoutOccurred
in interface IPoolStrategy
public int getWorkerCount()
getWorkerCount
in interface IPoolStrategy
public void setWorkerCount(int workercnt)
workercnt
- The workercnt to set.public int getCapacity()
getCapacity
in interface IPoolStrategy
public void setCapacity(int capacity)
capacity
- The capacity to set.public int getDesiredFree()
public void setDesiredFree(int desfree)
desfree
- The desfree to set.public long getMaxWait()
public void setMaxWait(long maxwait)
maxwait
- The maxwait to set.public int getMaxCount()
public void setMaxCount(int maxcnt)
maxservicecnt
- The max cnt to set.Copyright © 2013. All Rights Reserved.