[rules-users] The update function inside a rule

FrankVhh frank.vanhoenshoven at agserv.eu
Wed Mar 30 07:08:25 EDT 2011


Not entirely,

Wolfgang could probably explain this a lot better than me, but I will give
it a try.

1) Rule execution stops -or it should stop- as soon as there are no more
rules with conditions that are true. Therefor, the rules should only be
executed once.
2) You would not need your timer because the only thing it does, is to slow
down rule execution 1 sec. And, as wolfgang pointed out, the timer stops, or
should stop, once the condition becomes false. 

Now, in your case, it appears the only job the timer does, is to keep the
session alive, which appears to be a bug.

What you need, is not a timer. You need something to keep your session alive
during the time your conditions are false. Preferably something that is not
buggy. This could be achieved by f.e. fireUntilHalt(), or whatever
intelligent design you can come up with.



> About adding log to trace the values of endDate, the traces show correct
> values. But it doesn't trace the value viewed by the drools engine itself
> wich could be different (just as if I don't do an update() after a
> modification)
> 
If you rpint the value that is evaluated in the condition, that should be
the value drools sees... But I am not an expert in JVM, so I could be wrong.

Regards,
Frank



marc wrote:
> 
> I was using only one fireAllRules() after insert(message) and not
> fireUntilHalt(). But is should be enough : as the rule change & update the
> fact, the rule is applied again (10 seconds later, and not 1second).
> 
> With fireUntilHalt() the rule work fine (and without timer)... but it
> burns the CPU (the java process reach 50% on a bi-proc) while a simple
> call to fireAllRues() after the timer update use nothing... This doesn't
> make sense to me because the drools engine is only notified of a fact
> modification only 1 time per second (the timer update), so it should only
> fire all rules a this moment and that all (just like a fireAllRules()
> after the update(SimpleClock) does), so why does it takes so much CPU ? I
> can post the code but I should open a other thread because it not the same
> "problem" ?
> 
> About adding log to trace the values of endDate, the traces show correct
> values. But it doesn't trace the value viewed by the drools engine itself
> wich could be different (just as if I don't do an update() after a
> modification)
> 
> Marc
> 


--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/The-update-function-inside-a-rule-tp2747484p2753173.html
Sent from the Drools - User mailing list archive at Nabble.com.



More information about the rules-users mailing list