-->

what is the difference between no-loop and lock-on

2020-08-26 04:16发布

问题:

Here is an example of a rule that uses "no-loop":

rule "Even Number Rule"   
dialect "java"  
no-loop  
      when  
       n : Number( number !=0 && (number%2)==0 , value : number)  
    then  
        modify(n){setNumber(8)};  
      end

回答1:

Long story short:

  • no-loop: avoid the re-activation of a rule caused by the RHS of that SAME rule.
  • lock-on-active: avoid the re-activation of a rule NO MATTER what the cause is.

Long story: http://ilesteban.wordpress.com/2012/11/16/about-drools-and-infinite-execution-loops/

Hope it helps,



标签: drools