The ruleBase retains a reference to each StatefulSession is creates, so
that it can update them when new rules are added, dispose() is needed to
release the StatefulSession reference from the RuleBase, without it you
can get memory leaks.
If you insert your facts and your done, then stateless can be good
enough for you, if you aren't doing any modifies/retracts then you can
I have just started looking at drools 4 to upgrade from drools 3. While
reading the documentation, was wondering whether it is necessary to call
session.dispose() after session.fireAllRules() for the StatefulSession. If I
don't call session.dispose(), does that mean that the session will still be
Also, Reading the documentation, I was not exactly clear for the difference
between Stateful and Stateless sessions. Can you explain when
StatefulSession and when StatelessSession can be used?