Hi, you can add an extra restriction in C. That checks that the rules
property is empty in the first rule, the second, the third, the fourth
and the fifth will check the opposite. But the fifth rule will empty
again the rules property making the first rule fire again. I think
that you don't need lock on active or no loop with that.
Cheers
- Ing. Mauricio Salatino -
On Jan 17, 2010, at 9:23 AM, orchid <maya.pollack(a)gmail.com> wrote:
Hi All,
I have a question about avoiding infinite loop, not using 'no-loop'
or
'lock-active' since I want to re-activate rules. Suppose I have one
complex
class C and a chain of rules in which Rule2 checks the result of
Rule1, Rule
3 checks the result of rule 2, etc... In the last rule ("Rule5") I
want to
modify the class instance and re-activate the rules.
rule "Rule1"
when
$c:C(/*some conditions*/)
then
modify ($c){addRule("Rule1")}
end
rule "Rule2"
when
$c:C(rules contains "Rule1" && /*few more conditions*/)
then
modify ($c){addRule("Rule2")}
end
...
...
...
rule "Rule5"
when
$c:C(rules contains "Rule4" && /*few more conditions*/)
then
modify ($c){changeAttribute("...")}
end
In order to avoid infinite loop I added 'lock-on-active' to Rule1, and
'no-loop true' to the rest rules. But, then the rules are not re-
activated
as a result of Rule5. How can I cause re-activation of the rules. I
hope I
was clear enough :))
Thanks in advance !!!
--
View this message in context:
http://n3.nabble.com/Infinite-loop-when-re-activating-rules-tp123918p1239...
Sent from the Drools - User mailing list archive at
Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users