<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<br>
Alright... The test case was delivered with the following documentation
(extract of the "Drools JBoss Rules 5.0 Developer's Guide" book):<br>
<br>
"org.drools.runtime.StatelessKnowledgeSession<br>
This is a type of knowledge session that doesn't keep any state between
invocations (an invocation is a call of the execute method). From the
rules perspective, a stateless session is no different than a stateful
session—the rules look exactly the same. The benefit that statelessness
brings is that the rule engine can do more optimizations.
StatelessKnowledgeSession as well as stateful session support a command
interface (command design pattern). There is no need to dispose a
stateless session after it has been used."<br>
<br>
Bruno.<br>
<br>
Patrick van Kann a écrit :
<blockquote
cite="mid:AANLkTinMgvTqDD1EbZ4qzPp208zC-HdnxTqXnYVD6KwP@mail.gmail.com"
type="cite">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 moz-do-not-send="true"
href="mailto:bruno.freudensprung@temis.com">bruno.freudensprung@temis.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;"><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 moz-do-not-send="true" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a moz-do-not-send="true"
href="https://lists.jboss.org/mailman/listinfo/rules-users"
target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</blockquote>
</div>
<br>
<pre wrap="">
<hr size="4" width="90%">
_______________________________________________
rules-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a>
</pre>
</blockquote>
<br>
</body>
</html>