I see. Thank you.<div>For instance, retracting a fact with lots of pending activations associated with this fact could me expensive. Am I right?<br><br><div class="gmail_quote">2011/1/27 Esteban Aliverti <span dir="ltr">&lt;<a href="mailto:esteban.aliverti@gmail.com">esteban.aliverti@gmail.com</a>&gt;</span><br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Sessions are cheap to create. <div>The problem of removing all the facts and then insert new ones is that depending on you rules, could be much more expensive than throw the old session and create a new one. And you should also think about globals as well. Removing a Fact is not just taking it off from a list. There is a lot of logic involved there.</div>



<div>Is like if you have a populated List and you want to remove all its items and fill it with new ones (from another List for example).</div><div>What would you use?</div><div><br></div><div><div>originalList.clear();</div>



<div>originalList.addAll(anotherList);</div></div><div> </div><div>or</div><div><br></div><div>originalList = new ArrayList(anotherList);</div><div><br></div><div>Best Regards,</div><div><br>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX<br>

<font color="#888888">

<br>Esteban Aliverti<br>- Developer @ <a href="http://www.plugtree.com" target="_blank">http://www.plugtree.com </a><br>- Blog @ <a href="http://ilesteban.wordpress.com" target="_blank">http://ilesteban.wordpress.com</a></font><div>

<div></div><div class="h5"><br>


<br><br><div class="gmail_quote">On Thu, Jan 27, 2011 at 5:45 AM, hyjshanghai <span dir="ltr">&lt;<a href="mailto:hyjshanghai@gmail.com" target="_blank">hyjshanghai@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">



<br>
According to Section 3.3.7 &quot;StatelessKnowledgeSession&quot; of<br>
<a href="http://downloads.jboss.com/drools/docs/5.1.1.34858.FINAL/drools-expert/html/ch03.html#d0e1956" target="_blank">http://downloads.jboss.com/drools/docs/5.1.1.34858.FINAL/drools-expert/html/ch03.html#d0e1956</a><br>




the Drools document , &quot;the act of calling execute() is a single-shot method<br>
that will internally instantiate a StatefulKnowledgeSession&quot;.<br>
<br>
Why StatelessKnowledgeSession instantiates a new statefulKnowledgeSession<br>
object on Each execute()?<br>
<br>
Instead, can it be implemented as inserting the fact into an existing empty<br>
statefulKnowledgeSession, and retract the fact after<br>
statefulKnowledgeSession.fireAllRules()?<br>
<br>
I think the current implementation will cause StatelessKnowledgeSession  to<br>
be slower than statefulKnowledgeSession, as opposed to &quot;common sense&quot; that<br>
the former is less complex and should be faster. Any performance benchmark<br>
on Stateless v.s. Stateful Sessions?<br>
<font color="#888888">--<br>
View this message in context: <a href="http://drools-java-rules-engine.46999.n3.nabble.com/Why-StatelessKnowledgeSession-Instantiates-a-New-StatefulKnowledgeSession-on-Each-execute-tp2360846p2360846.html" target="_blank">http://drools-java-rules-engine.46999.n3.nabble.com/Why-StatelessKnowledgeSession-Instantiates-a-New-StatefulKnowledgeSession-on-Each-execute-tp2360846p2360846.html</a><br>




Sent from the Drools - User mailing list archive at Nabble.com.<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org" target="_blank">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>
</font></blockquote></div><br></div></div></div>
<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>
<br></blockquote></div><br><br clear="all"><br>-- <br>Best Wishes,<br>Huang, Yijian<br>
</div>