[rules-users] inserting collection of facts

Greg Barton greg_barton at yahoo.com
Fri Nov 7 20:08:09 EST 2008


--- On Fri, 11/7/08, techy <techluver007 at gmail.com> wrote:

> Can you please advise which of two is best approach?
> 
> 1. Having multiple rulebase and assign to child thread.
> each child thread would a single stateful session and fire rule for 
> given facts.
> 2. having one rulebase and create multiple stateful session
> and assign to each child thread.

That would depend on the structure of the rules, and specifically on the number of object join rules in your rule base.  The only way to know, truthfully, is to try both ways with typical data sets.  

> 3. I would give batch of facts to child threads. once they
> complete the firing rules. now I want to release these facts from 
> memory before I process next batch of facts using same or new child 
> threads.  Do I need to do any explicit clean up in either rulebase or 
> stateful session ? or would JVM GC take care of the clean up as long 
> as I don't maintain any ref to those facts in my application?

You  must retract them from the working memory for the objects to be GC'ed.  Otherwise the stateful session would maintain a reference to them.  You could also just destroy the stateful session itself.  That might actually be quicker. (Assuming that you're starting the stateful session from starting conditions during each batch run.)  Although at that point why have a stateful session? :)  It sounds to me like a stateless session might be more what you need, really.  Have you tried it?



      



More information about the rules-users mailing list