If the aim is purely optimization then in that case it won't work (even ignoring the fact you haven't told drools you are updating $co). Activations are evaluated first then rules are fired. If an activation updates an object then activations are recalculated.
Are you actually having performance problems with drools or are you trying to optimize prematurely? You seem to be under a misconception of how drools works if you are worried about it trying to match every rule against every object and probably need to read up about the Rete algorithms and how drools implements it. http://blog.athico.com/ is a good place to start searching through for information and if you want really detailed information and advice read chapter 12 of the book "Drools JBoss rules 5.0 developer's guide". Thomas > -----Original Message----- > From: [email protected] [mailto:rules-users- > [email protected]] On Behalf Of madchen > Sent: 08 April 2010 16:25 > To: [email protected] > Subject: Re: [rules-users] Drools Flow: Skipping some LHS evaluations attime > of insert > > > Okay so correct me if I'm wrong, but what you're suggesting is something like > this: > > rule "1" > when > $v :variable(blah = "matches") > $co : controlObject > then > System.out.println("Yay it matched") > $co.setDoneTrue > end > > rule "2" > when > $v2 :variableTwo(blah = "matches") > $co : controlObject(done != True) > then > //do some stuff > end > > So basically, when the first rule activates and fires, it sets the > controlObject.done to true and then the second rule will not fire because > done is true. In this case, it seems that drools will run through the tests > for each rule and match it against the control object. > > Basically, I'm looking to improve the performance of Drools and in my case, > if it matches one rule, then there would be no reason to check the other > ones. Therefore, I'm trying to not have drools check every rule against > every object. > -- > View this message in context: http://n3.nabble.com/Drools-Flow-Skipping-some- > LHS-evaluations-at-time-of-insert-tp704324p706256.html > Sent from the Drools - User mailing list archive at Nabble.com. > _______________________________________________ > rules-users mailing list > [email protected] > https://lists.jboss.org/mailman/listinfo/rules-users ************************************************************************************** This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the [email protected] and delete it from your system as well as any copies. The content of e-mails as well as traffic data may be monitored by NDS for employment and security purposes. To protect the environment please do not print this e-mail unless necessary. NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, United Kingdom. A company registered in England and Wales. Registered no. 3080780. VAT no. GB 603 8808 40-00 ************************************************************************************** This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the [email protected] and delete it from your system as well as any copies. The content of e-mails as well as traffic data may be monitored by NDS for employment and security purposes. To protect the environment please do not print this e-mail unless necessary. An NDS Group Limited company. www.nds.com _______________________________________________ rules-users mailing list [email protected] https://lists.jboss.org/mailman/listinfo/rules-users
