[rules-users] How can I know, how many facts are processed by stateFulSession?

tom ska tiberium.linux at gmail.com
Tue Aug 31 09:02:13 EDT 2010


Hello,
I have a class and rule:

class CTestObj
{
        private double value;

        void setValue(double v) {
                this.value = v;
        }

        double getValue() {
                return this.value;
        }
}

rule "r1"
    when
        p : CTestObj
    then
        p.setValue( 1 / p.getValue() );
end

As you can see, in this rule, there is risk, to put into stateFulSession
object with value set 0. I can't validate this, because, this problem has a
variation where I put into stateFulSession object with set no 0, but the
rule will modify it...
So - I can't validate this = fact with value 0 is correct.

But I process with stateFulSession many, many facts... For example 1000.
And, after 900 facts it occurs, that fact number 901 has value set on 0. In
effect I get an exception:  org.drools.runtime.rule.ConsequenceException:
java.lang.ArithmeticException: / by zero. And ksession stops processing
facts. But, 900 facts are processed! I don't want to process them second
time.
And this is my question:

How can I know, which fact is first no-processed fact? Which one stoped
fireAllRules method?
Beacuse I don't want to process them another time.

Greetings :)
tom.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100831/c8ce8dc4/attachment.html 


More information about the rules-users mailing list