Hi all,<div>I&#39;m dealing with a set of rules having the lock-on-active attribute and I&#39;m not getting the (at least what I understand as) expected results.</div><div><br></div><div>I&#39;ve created an isolated JUnit test. I&#39;m attaching it to this email.</div>

<div><br></div><div>Basically, I have 2 rules:</div><div><br></div><div><br></div><div><div>rule &quot;init&quot;</div><div>lock-on-active true</div><div>when</div><div>    $d: DataSample()</div><div>then</div><div>    System.out.println(&quot;Setting predefined value&quot;);</div>

<div>    modify($d){</div><div>        addValue(Parameter.PARAM_A, 10.0)</div><div>    }</div><div>end</div><div><br></div><div>rule &quot;Rule 1&quot;</div><div>lock-on-active true</div><div>when</div><div>    DataSample($v: values[Parameter.PARAM_A] &lt; 20)</div>

<div>then</div><div>    System.out.println(&quot;Rule 1: &quot;+$v);</div><div>end</div></div><div><br></div><div><br></div><div>DataSample is a Java class containing a Map&lt;Parameter, Double&gt; where Parameter is an enum.</div>

<div>In the test I&#39;m creating a ksession and inserting an empty DataSample object. </div><div>I understand that as soon as the object is inserted, both rules are evaluated and the result is going to be an activation of rule &quot;init&quot;; and this is what is actually happening. So far so good.</div>

<div>Now, after I call fireAllRules() I expect that &#39;Rule 1&#39; becomes active because of the modification of the fact in &quot;init&quot;. Well, this is not the case. I don&#39;t see any activation for &quot;Rule 1&quot;.</div>

<div>My understanding about lock-on-active is that a rule that WAS ACTIVATED is not going to be re-activated until the current agenda group is switched. The odd thing here is that I never had an activation for &quot;Rule 1&quot; so I don&#39;t see why it activation after &quot;init&quot; is executed should be prevented.</div>

<div>So my question is: Is my understanding wrong? What is the expected behavior of lock-on-active in this situation? I read the documentation but I couldn&#39;t get any hint:</div><div><br></div><div>&quot;<a id="d0e5148" style="color:rgb(51,51,51);font-family:&#39;Lucida Grande&#39;,Geneva,Verdana,Arial,sans-serif;font-size:12px;line-height:18px;text-align:justify"><dd style="margin:0em 0em 0em 2em;padding-top:0em;display:inline!important">

<p style="display:inline!important">Whenever a ruleflow-group becomes active or an agenda-group receives the focus, any rule within that group that has lock-on-active set to true<b> will not be activated any more</b>; irrespective of the origin of the update, the activation of a matching rule is discarded. This is a stronger version of no-loop, because the change could now be caused not only by the rule itself. It&#39;s ideal for calculation rules where you have a number of rules that modify a fact and you don&#39;t want any rule re-matching and firing again. Only when the ruleflow-group is no longer active or the agenda-group loses the focus those rules with lock-on-active set to true become eligible again for their activations to be placed onto the agenda.&quot;</p>

</dd></a></div><div><br></div><div>Best Regards,</div><div> </div><div><br>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX<br><br>Esteban Aliverti<br>- Blog @ <a href="http://ilesteban.wordpress.com" target="_blank">http://ilesteban.wordpress.com</a><br>


</div>