org.eclipse.smila.workermanager
Class ScaleUpControl
java.lang.Object
org.eclipse.smila.workermanager.ScaleUpControl
public class ScaleUpControl
- extends java.lang.Object
Helper class for handling (java) worker scale up.
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ScaleUpControl
public ScaleUpControl()
- instance with default scale up limits.
ScaleUpControl
public ScaleUpControl(ClusterConfigService clusterService)
- Parameters:
clusterService - holds scale up configuration for each worker
canGetTask
public boolean canGetTask(java.lang.String workerName,
boolean isRunAlways)
- Returns:
- 'true' if this worker is allowed to get another task, 'false' otherwise.
incTaskCounter
public void incTaskCounter(java.lang.String worker)
- Parameters:
worker - the worker for which to increment the task counter.
decTaskCounter
public void decTaskCounter(java.lang.String worker)
- Parameters:
worker - the worker for which to decrement the task counter.
getTaskCounter
public int getTaskCounter(java.lang.String worker)
- Parameters:
worker - the worker for which to get the counter.
- Returns:
- a counter of currently processed tasks
getScaleUpLimit
public int getScaleUpLimit(java.lang.String worker)
- Parameters:
worker - the worker for which to get the limit.
- Returns:
- scaleUp limit for this worker. defaults to 1 if no value is set.
setScaleUpLimit
public void setScaleUpLimit(java.lang.String worker,
java.lang.Long scaleUp)
- Parameters:
worker - a workerscaleUp - max scale up limit for the worker.