org.quartz.locality.constraint.evaluator
Class CpuEvaluator

java.lang.Object
  extended by java.util.TimerTask
      extended by org.quartz.locality.constraint.evaluator.EvaluatorTimerTask
          extended by 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

Nested Class Summary
 
Nested classes/interfaces inherited from class org.quartz.locality.constraint.evaluator.EvaluatorTimerTask
EvaluatorTimerTask.Status
 
Field Summary
static boolean mxBeanAvgLoadMonitoring
           
 
Constructor Summary
CpuEvaluator(Integer availableThreads)
           
 
Method Summary
 int getAvailableThreads()
           
 boolean hasAvailableThread()
           
 boolean hasAvailableThread(String node)
           
 void initialize(String nodeName, ConcurrentMap<String,ConcurrentMap<String,Integer>> storeMap)
          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
 boolean matches(CpuConstraint constraint)
          Evaluates the constraint against local node.
protected  void monitor()
           
 List<String> suitedNodes(CpuConstraint constraint)
          Returns a list of best suited node (instanceId) based on the constraint
 void threadAcquired()
           
 void threadReleased()
           
 void verify(CpuConstraint constraint)
          Verifies the validity of a constraint.
 
Methods inherited from class org.quartz.locality.constraint.evaluator.EvaluatorTimerTask
cancelMonitoring, getInterval, getStatus, pauseMonitoring, resumeMonitoring, run, startMonitoring
 
Methods inherited from class java.util.TimerTask
cancel, scheduledExecutionTime
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mxBeanAvgLoadMonitoring

public static final boolean mxBeanAvgLoadMonitoring
Constructor Detail

CpuEvaluator

public CpuEvaluator(Integer availableThreads)
Method Detail

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 instanceId
storeMap - 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.