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.Runnable
A 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 Log
log
protected SUPERVISOR
sv
-
Constructor Summary
Constructors Constructor Description Rule()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract java.lang.String
condition()
Returns a description of the condition that led toeval()
returning trueabstract java.lang.String
description()
Describes what the rules doesvoid
destroy()
Called when rule is uninstalledabstract boolean
eval()
Evaluates the condition.void
init()
Called when rule is installedRule
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.
-
-
-
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.Throwable
The action of the rule. Triggered ifeval()
returned true- Throws:
java.lang.Throwable
-
run
public void run()
- Specified by:
run
in interfacejava.lang.Runnable
-
-