[rules-users] Drools 4 Stateful Session dispose

Mark Proctor mproctor at codehaus.org
Thu Sep 13 19:36:08 EDT 2007


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 
do stateles+sequential.

Mark
mule1 wrote:
> Hello,
>
> 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
> garbage collected?
>
> 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?
>
> Thanks.
>   




More information about the rules-users mailing list