Using Drools 5.3.0.<br><br>I find that my &quot;java&quot; version produces three calls (one true, two false). This is my dialect &quot;java&quot; version of the first rule:<br><br>dialect &quot;java&quot;<br>rule &quot;First Rule&quot;<br>
   when<br>       $tf : TestFact(TestUtility.utilMethod($tf.getS(), &quot;Value1&quot;) == true &amp;&amp;<br>                     i &gt; 0<br>        )<br>   then<br>       System.out.println(&quot;First Rule Fires&quot;);<br>
end<br><br>The MVEL version executes six (6) calls: two returning true, and four returning false. <br><br>-W<b><br></b><br><br><div class="gmail_quote">On 5 January 2012 14:55, ronalbury <span dir="ltr">&lt;<a href="mailto:ronalbury@gmail.com">ronalbury@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left:1px solid rgb(204,204,204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex">Here is a very simple test.  Note that utilMethod is called twice for the<br>
first rule, but is never called for the other two rules.  If you convert to<br>
Java dialect then things execute as expected.<br>
<br>
<br>
TestRules.drl:<br>
#created on: Jan 5, 2012<br>
package com.sample<br>
<br>
import com.sample.TestUtility;<br>
<br>
rule &quot;First Rule&quot;<br>
    when<br>
        $tf : TestFact(TestUtility.utilMethod(s, &quot;Value1&quot;) == true<br>
                  &amp;&amp; i &gt; 0<br>
        )<br>
    then<br>
        System.out.println(&quot;First Rule Fires&quot;);<br>
end<br>
<br>
rule &quot;Second Rule&quot;<br>
    when<br>
        $tf : TestFact(TestUtility.utilMethod(s, &quot;Value2&quot;) == true<br>
                  &amp;&amp; i &gt; 0<br>
        )<br>
    then<br>
        System.out.println(&quot;Second Rule Fires&quot;);<br>
end<br>
<br>
rule &quot;Third Rule&quot;<br>
    when<br>
        $tf : TestFact(TestUtility.utilMethod(s, &quot;Value3&quot;) == true<br>
                  &amp;&amp; i &gt; 0<br>
        )<br>
    then<br>
        System.out.println(&quot;Third Rule Fires&quot;);<br>
end<br>
<br>
<br>
<br>
TestUtility.java:<br>
package com.sample;<br>
<br>
public class TestUtility {<br>
    public static Boolean utilMethod(String s1, String s2) {<br>
        Boolean result = null;<br>
<br>
        if (s1 != null) {<br>
            result = s1.equals(s2);<br>
        }<br>
<br>
        System.out.println(&quot;in utilMethod &gt;&quot; + s1 + &quot;&lt;  &gt;&quot; + s2 + &quot;&lt; returns<br>
&quot; + result);<br>
        return result;<br>
    }<br>
}<br>
<br>
TestDriver.java:<br>
    public static final void main(String[] args) {<br>
        try {<br>
            // load up the knowledge base<br>
            KnowledgeBase kbase = readKnowledgeBase();<br>
            StatefulKnowledgeSession ksession =<br>
kbase.newStatefulKnowledgeSession();<br>
<br>
            // setup the debug listeners<br>
            ksession.addEventListener(new DebugAgendaEventListener());<br>
            ksession.addEventListener(new<br>
DebugWorkingMemoryEventListener());<br>
            KnowledgeRuntimeLogger logger =<br>
KnowledgeRuntimeLoggerFactory.newFileLogger(ksession, &quot;test&quot;);<br>
<br>
            // go !<br>
            TestFact fact = new TestFact();<br>
            fact.setS(&quot;asdf&quot;);<br>
            fact.setI(10);<br>
            ksession.insert(fact);<br>
            ksession.fireAllRules();<br>
            logger.close();<br>
        }<br>
        catch (Throwable t) {<br>
            t.printStackTrace();<br>
        }<br>
    }<br>
<br>
<br>
Output:<br>
in utilMethod &gt;asdf&lt;  &gt;Value1&lt; returns false<br>
in utilMethod &gt;asdf&lt;  &gt;Value1&lt; returns false<br>
==&gt;[ObjectInsertedEventImpl: getFactHandle()=[fact<br>
0:1:31556811:31556811:1:DEFAULT:com.sample.TestFact@1e184cb],<br>
getObject()=com.sample.TestFact@1e184cb,<br>
getKnowledgeRuntime()=org.drools.impl.StatefulKnowledgeSessionImpl@70610a,<br>
getPropagationContext()=PropagationContextImpl [activeActivations=0,<br>
dormantActivations=0, entryPoint=EntryPoint::DEFAULT, factHandle=[fact<br>
0:1:31556811:31556811:1:DEFAULT:com.sample.TestFact@1e184cb],<br>
leftTuple=null, originOffset=-1, propagationNumber=3, rule=null, type=0]]<br>
<span class="HOEnZb"><font color="#888888"><br>
<br>
--<br>
View this message in context: <a href="http://drools.46999.n3.nabble.com/Error-in-MVEL-execution-optimization-tp3633440p3634884.html" target="_blank">http://drools.46999.n3.nabble.com/Error-in-MVEL-execution-optimization-tp3633440p3634884.html</a><br>

</font></span><div class="HOEnZb"><div class="h5">Sent from the Drools: User forum mailing list archive at Nabble.com.<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</div></div></blockquote></div><br>