I might be putting too simplistic an interpretation on this, but this is
what the Javadoc says for StatelessKnowledgeSession
"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()."
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.
Cheers,
Pat
On Tue, Oct 26, 2010 at 3:50 PM, Bruno Freudensprung <
bruno.freudensprung(a)temis.com> wrote:
Hi,
According to what I've read so far, you can reuse Stateless sessions.
In particlar I've seen unit tests creating a Stateless session in a
@BeforeClass method, then this session was re-used across multiple tests
methods "pushing" different data-sets into that unique session instance
using commands (created with the org.drools.command.CommandFactory class).
Regards,
Bruno.
espen a écrit :
> Hi,
>
> we have an application with a lot of rules in a cached rulebase. When we
> profile our application we see that about 30% of the time is used in
> rulebase.newStatlessSession(). The time is basically used loading
classes.
>
> The question is, is it possible to create a pool of StalessSessions and
> reuse them, or will this create problems.
>
> Regards
> Espen
>
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users