I might be putting too simplistic an interpretation on this, but this is what the Javadoc says for StatelessKnowledgeSession<br><br>"StatelessKnowledgeSession provides a convenience API, wrapping
StatefulKnowledgeSession. It avoids the need to
call dispose(). Stateless sessions do not support
iterative insertions and fireAllRules from Java code, the act of
calling execute(...) is a single
shot method that will internally instantiate a
StatefulKnowledgeSession, add all the user data and execute user
commands, call fireAllRules, and then
call dispose()."<br><br>So I'm not sure why you just wouldn't just
directly use a StatefulKnowledgeSession instead of trying to re-use a
stateless one. You can then update the Facts via their handles and
update or retract and reinsert as needed.<br>
<br>Cheers,<br><br>Pat<br><br><div class="gmail_quote">On Tue, Oct 26, 2010 at 3:50 PM, Bruno Freudensprung <span dir="ltr"><<a href="mailto:bruno.freudensprung@temis.com">bruno.freudensprung@temis.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><br>
Hi,<br>
<br>
According to what I've read so far, you can reuse Stateless sessions.<br>
In particlar I've seen unit tests creating a Stateless session in a<br>
@BeforeClass method, then this session was re-used across multiple tests<br>
methods "pushing" different data-sets into that unique session instance<br>
using commands (created with the org.drools.command.CommandFactory class).<br>
<br>
Regards,<br>
<br>
Bruno.<br>
<br>
espen a écrit :<br>
> Hi,<br>
><br>
> we have an application with a lot of rules in a cached rulebase. When we<br>
> profile our application we see that about 30% of the time is used in<br>
> rulebase.newStatlessSession(). The time is basically used loading classes.<br>
><br>
> The question is, is it possible to create a pool of StalessSessions and<br>
> reuse them, or will this create problems.<br>
><br>
> Regards<br>
> Espen<br>
><br>
<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>
</blockquote></div><br>