org.quartz.locality.constraint.evaluator
Class MemoryEvaluator

java.lang.Object
  extended by java.util.TimerTask
      extended by org.quartz.locality.constraint.evaluator.EvaluatorTimerTask
          extended by org.quartz.locality.constraint.evaluator.MemoryEvaluator
All Implemented Interfaces:
Runnable, Evaluator<MemoryConstraint>, PersistentEvaluator<MemoryConstraint,Long>

public class MemoryEvaluator
extends EvaluatorTimerTask
implements PersistentEvaluator<MemoryConstraint,Long>

Evaluates memory constraints

Author:
Alex Snaps

Nested Class Summary
 
Nested classes/interfaces inherited from class org.quartz.locality.constraint.evaluator.EvaluatorTimerTask
EvaluatorTimerTask.Status
 
Constructor Summary
MemoryEvaluator()
           
 
Method Summary
 void initialize(String nodeName, ConcurrentMap<String,Long> map)
          Will start the monitoring, to store available memory on the local node in the shared map.
 boolean matches(MemoryConstraint constraint)
          Evaluates the constraint against local node.
 boolean matches(MemoryConstraint constraint, String node)
          Verifies whether the constraint passed is validating on the node
 void monitor()
          Performs the monitoring of the free memory on the local node
 List<String> suitedNodes(MemoryConstraint constraint)
          Returns a list of best suited node (instanceId) based on the constraint
 void verify(MemoryConstraint constraint)
          Always true
 
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
 

Constructor Detail

MemoryEvaluator

public MemoryEvaluator()
Method Detail

matches

public boolean matches(MemoryConstraint constraint)
Evaluates the constraint against local node.

Specified by:
matches in interface Evaluator<MemoryConstraint>
Parameters:
constraint - The constraint to evaluate
Returns:
true if local node is a match
See Also:
Constraint#matches(Object)

matches

public boolean matches(MemoryConstraint constraint,
                       String node)
Verifies whether the constraint passed is validating on the node

Parameters:
constraint - The constraint to evaluate
node - The node to evaluate against
Returns:
true if node is a match

suitedNodes

public List<String> suitedNodes(MemoryConstraint constraint)
Returns a list of best suited node (instanceId) based on the constraint

Specified by:
suitedNodes in interface Evaluator<MemoryConstraint>
Parameters:
constraint - To find best suited nodes for
Returns:
List of best suited Quartz instanceId

verify

public void verify(MemoryConstraint constraint)
Always true

Specified by:
verify in interface Evaluator<MemoryConstraint>
Parameters:
constraint - The constraint to validate

monitor

public void monitor()
Performs the monitoring of the free memory on the local node

Specified by:
monitor in class EvaluatorTimerTask

initialize

public void initialize(String nodeName,
                       ConcurrentMap<String,Long> map)
Will start the monitoring, to store available memory on the local node in the shared map.

Specified by:
initialize in interface PersistentEvaluator<MemoryConstraint,Long>
Parameters:
nodeName - Local instanceId
map - the shared persistent storage for the Evaluator


Copyright 2001-2013, Terracotta, Inc.