org.quartz.locality.constraint.evaluator
Class CpuEvaluator
java.lang.Object
java.util.TimerTask
org.quartz.locality.constraint.evaluator.EvaluatorTimerTask
org.quartz.locality.constraint.evaluator.CpuEvaluator
- All Implemented Interfaces:
- Runnable, Evaluator<CpuConstraint>, PersistentEvaluator<CpuConstraint,ConcurrentMap<String,Integer>>
public class CpuEvaluator
- extends EvaluatorTimerTask
- implements PersistentEvaluator<CpuConstraint,ConcurrentMap<String,Integer>>
- Author:
- Alex Snaps
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
mxBeanAvgLoadMonitoring
public static final boolean mxBeanAvgLoadMonitoring
CpuEvaluator
public CpuEvaluator(Integer availableThreads)
matches
public boolean matches(CpuConstraint constraint)
- Description copied from interface:
Evaluator
- Evaluates the constraint against local node.
- Specified by:
matches
in interface Evaluator<CpuConstraint>
- Parameters:
constraint
- The constraint to evaluate
- Returns:
- true if local node is a match
- See Also:
Constraint#matches(Object)
suitedNodes
public List<String> suitedNodes(CpuConstraint constraint)
- Description copied from interface:
Evaluator
- Returns a list of best suited node (instanceId) based on the constraint
- Specified by:
suitedNodes
in interface Evaluator<CpuConstraint>
- Parameters:
constraint
- To find best suited nodes for
- Returns:
- List of best suited Quartz instanceId
verify
public void verify(CpuConstraint constraint)
- Description copied from interface:
Evaluator
- Verifies the validity of a constraint. Throws exception should the constraint fail to validate.
- Specified by:
verify
in interface Evaluator<CpuConstraint>
- Parameters:
constraint
- The constraint to validate
initialize
public void initialize(String nodeName,
ConcurrentMap<String,ConcurrentMap<String,Integer>> storeMap)
- Description copied from interface:
PersistentEvaluator
- During its bootstrapping, the
JobStore
will call this method once on each node,
passing a Clustered ConcurrentMap
instance and the local instanceId of the Scheduler
- Specified by:
initialize
in interface PersistentEvaluator<CpuConstraint,ConcurrentMap<String,Integer>>
- Parameters:
nodeName
- Local instanceIdstoreMap
- the shared persistent storage for the Evaluator
threadAcquired
public void threadAcquired()
threadReleased
public void threadReleased()
hasAvailableThread
public boolean hasAvailableThread(String node)
hasAvailableThread
public boolean hasAvailableThread()
monitor
protected void monitor()
- Specified by:
monitor
in class EvaluatorTimerTask
getAvailableThreads
public int getAvailableThreads()
Copyright 2001-2013, Terracotta, Inc.