On 12 August 2011 17:46, FrankVhh <frank.vanhoenshoven(a)agserv.eu> wrote:
The difference between stateful and stateless is basically this:
- Stateful: the engine will be able to reevaluate the rules during
execution, hereby enabling foreward chaining.
- Stateless: engine will not do any reevaluations, the state of the facts
as they come in to the engine, will be considered their fixed state, even
if
they are modified.
This is not quite right. An org.drools.runtime.StatelessKnowledgeSession is
nothing but a simplifying wrapper for a StatefulKnowledgeSession. The
wrapper restricts you to "execute", after which it is "game over":
the
session is a goner. But, while it is doing its rule firing callisthenics it
is behaving just like a StatefulKnowledgeSession.
There is, however, a special mode for running a StatelessKnowledgeSesssion:
"sequential mode". This, then, results in the restrictions described by
Frank, coupled with some performance gains.
-W