Package org.jgroups.protocols.rules
Class Rule
- java.lang.Object
-
- 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.RunnableA rule with a condition and (optional) action. When a rule is run, the condition is checked witheval()and - if true - the action is triggered withtrigger().- Since:
- 3.3
- Author:
- Bela Ban
-
-
Field Summary
Fields Modifier and Type Field Description protected Loglogprotected SUPERVISORsv
-
Constructor Summary
Constructors Constructor Description Rule()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract java.lang.Stringcondition()Returns a description of the condition that led toeval()returning trueabstract java.lang.Stringdescription()Describes what the rules doesvoiddestroy()Called when rule is uninstalledabstract booleaneval()Evaluates the condition.voidinit()Called when rule is installedRulelog(Log log)abstract java.lang.Stringname()Returns the name of the rule.voidrun()Rulesupervisor(SUPERVISOR sv)abstract voidtrigger()The action of the rule.
-
-
-
Field Detail
-
sv
protected SUPERVISOR sv
-
log
protected Log log
-
-
Method Detail
-
supervisor
public Rule supervisor(SUPERVISOR sv)
-
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 ofcondition()should return a non-null string
-
condition
public abstract java.lang.String condition()
Returns a description of the condition that led toeval()returning true
-
trigger
public abstract void trigger() throws java.lang.ThrowableThe action of the rule. Triggered ifeval()returned true- Throws:
java.lang.Throwable
-
run
public void run()
- Specified by:
runin interfacejava.lang.Runnable
-
-