Below is a self-contained DRL showing the effect. Please note that the dialect rule attribute isn't really important. If you use "$p.getName()" to retrieve the name, the call is made once; as soon as you use just "name", the matchXXX is called twice.<br>
<br>To run, compile, create a session, fireAllRules.<br><br>-W<br><br>package mvelmvel;<br><br>declare Person<br> name: String<br> age: int<br>end<br><br>function boolean matchJava(String s1, String s2){<br> System.out.println( "matchJava: " + s1 + "==" + s2 );<br>
return s1.equals( s2 );<br>}<br>function boolean matchMVEL(String s1, String s2){<br> System.out.println( "matchMVEL: " + s1 + "==" + s2 );<br> return s1.equals( s2 );<br>}<br><br>rule init<br>
salience 100<br>when<br>then<br> Person p = new Person( "Joe", 42 );<br> insert( p );<br>end<br><br>rule testMVEL<br>dialect "mvel"<br>when<br> $p: Person( matchMVEL( name, "Joe" ) == true && age > 40 )<br>
then<br> System.out.println( "testMVEL: old Joe" );<br>end<br><br>rule testJava<br>dialect "java"<br>when<br> $p: Person( matchJava( $p.getName(), "Joe" ) == true && age > 40 )<br>
then<br> System.out.println( "testJava: old Joe" );<br>end<br><br><br><br><div class="gmail_quote">On 5 January 2012 16:50, ronalbury <span dir="ltr"><<a href="mailto:ronalbury@gmail.com">ronalbury@gmail.com</a>></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">Mark: I know what Jira is ... but I don't know what you mean by a pull<br>
request ... I also don't have it set up as a JUnit test.<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
View this message in context: <a href="http://drools.46999.n3.nabble.com/Error-in-MVEL-execution-optimization-tp3633440p3635295.html" target="_blank">http://drools.46999.n3.nabble.com/Error-in-MVEL-execution-optimization-tp3633440p3635295.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>