[rules-users] can i reuse rulebase

Mark Proctor mproctor at codehaus.org
Tue Jan 22 17:50:15 EST 2008


jack wu wrote:
> my profiler shows that it takes the same amount of time to do:
>
> final RuleBase ruleBase = RuleBaseFactory.newRuleBase( 
> RuleBase.RETEOO, conf );
>
> as to do:
> session.executeWithResults();
>
> i am wondering if i can cache the ruleBase and do addPackage() and 
> removePackage() for each executeWithResults().
>
> the ducmentation says always create a new ruleBase. so i am kind of 
> confused. thanks for the help.
Yes you can do this, but it's not thread safe (unlike stateful 
sessions). The stateless session could be propagating data mid change 
and thus leaving the network invalid. So if you do this, which is not 
recommended practice, do make sure that you know that there are 
currently no valid executing sessions for that RuleBase.
>
> thanks.
>
> ------------------------------------------------------------------------
> Looking for last minute shopping deals? Find them fast with Yahoo! 
> Search. 
> <http://us.rd.yahoo.com/evt=51734/*http://tools.search.yahoo.com/newsearch/category.php?category=shopping> 
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>   

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20080122/7279ea4a/attachment.html 


More information about the rules-users mailing list