I have a question about alpha node sharing in release 4.0MR2. In the API for class RuleBaseConfiguration there is a method to turn alpha node sharing on and off. However, I get some odd behaviour when I turn it off and I was hoping someone can help me understand what's going on. I'll illustrate the behaviour with the two rules "First" and Second" defined below. Both rules work with a class Customer, which is a simple object with attribute age.
rule "First"
salience 10
when
c: Customer(age <= 10)
then
System.out.println("First - Customer age less than 10");
end
rule "Second"
salience 5
when
c: Customer(age <= 10)
then
System.out.println("Second - Customer age less than 10");
end
In the default case where alpha node sharing is on, I assert a customer with age 5 and fireAllRules to get the following (hopefully, correct) output:
First - Customer age less than 10
Second - Customer age less than 10
However, if I set the setShareAlphaNodes(false) to turn off alpha node sharing I get the following output:
First - Customer age less than 10
Reading the manual, I had assumed that the alpha node sharing was just an optimization, and switching it off may be inefficient, but would give the same output for the example rules. Is this correct, or have I missunderstood alpha node sharing. I've tried switching off alpha node sharing both directly via the API method, and using the system property option, but the behaviour is the same in both cases.
Regards
Shahad