org.jgroups.protocols.rules
Class Rule

java.lang.Object
  extended by org.jgroups.protocols.rules.Rule
All Implemented Interfaces:
java.lang.Runnable
Direct Known Subclasses:
CheckFDMonitor, SampleRule

public abstract class Rule
extends java.lang.Object
implements java.lang.Runnable

A rule with a condition and (optional) action. When a rule is run, the condition is checked with eval() and - if true - the action is triggered with trigger().

Since:
3.3
Author:
Bela Ban

Field Summary
protected  Log log
           
protected  SUPERVISOR sv
           
 
Constructor Summary
Rule()
           
 
Method Summary
abstract  java.lang.String condition()
          Returns a description of the condition that led to eval() returning true
abstract  java.lang.String description()
          Describes what the rules does
 void destroy()
          Called when rule is uninstalled
abstract  boolean eval()
          Evaluates the condition.
 void init()
          Called when rule is installed
 Rule log(Log log)
           
abstract  java.lang.String name()
          Returns the name of the rule.
 void run()
           
 Rule supervisor(SUPERVISOR sv)
           
abstract  void trigger()
          The action of the rule.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sv

protected SUPERVISOR sv

log

protected Log log
Constructor Detail

Rule

public Rule()
Method Detail

supervisor

public Rule supervisor(SUPERVISOR sv)

log

public Rule log(Log log)

name

public abstract java.lang.String name()
Returns the name of the rule. Should be unique if a rule needs to be uninstalled


description

public abstract java.lang.String description()
Describes what the rules does


init

public void init()
Called when rule is installed


destroy

public void destroy()
Called when rule is uninstalled


eval

public abstract boolean eval()
Evaluates the condition. If true, the rule is triggered. If true, the next execution of condition() should return a non-null string


condition

public abstract java.lang.String condition()
Returns a description of the condition that led to eval() returning true


trigger

public abstract void trigger()
                      throws java.lang.Throwable
The action of the rule. Triggered if eval() returned true

Throws:
java.lang.Throwable

run

public void run()
Specified by:
run in interface java.lang.Runnable


Copyright © 1998-2012 Bela Ban / Red Hat. All Rights Reserved.