[rules-users] no-loop & lock-on-active clarification

techy techluver007 at gmail.com
Tue Nov 11 11:25:20 EST 2008



I tried following rules as given below and result  are:(assumes facts which
I tried are qualified for both rules)

1. when lock-on-active used with both rule, only rule "1 precondition" got
executed for all facts.
2. when no-loop used with both rules, infinite loop
3. when lock-on-active for rule "1 precondition" and no-loop for rule "1
main condition" used, both rule got fired correctly.
4. for vice versa of 3 scenario, only rule "1 precondition" got executed for
all facts. 
Can someone please clarify about this scenario and also diff between no-loop
& lock-on-active? when we should use one and when should not?
I went thru documentation and still could not understand the difference.

public class Foo
{
    private Set<String> preConditionPassedRules ;
   
    private Integer f1;
    private Integer f2;
    
}

rule "1 precondition"
	salience 100
       
	when
		foo : Foo( f1 != null && f2 != null)
	then 
		foo.addPreconditionPassedRule("1 precondition");
                update(foo)
		
end

rule "1 main condition"
	salience 100
        
	when
		foo : Foo( preconditionPassedRule contains "1 precondition",f1 > 1000,f2 
< 1000)
	then 
		#actions
		
end

-- 
View this message in context: http://www.nabble.com/no-loop---lock-on-active-clarification-tp20443036p20443036.html
Sent from the drools - user mailing list archive at Nabble.com.




More information about the rules-users mailing list