[rules-dev] Possible Bug: Nodes of inherited types with drools.getActivation().remove()

Arjun Dhar dhar_ar at yahoo.com
Fri Jun 1 07:06:31 EDT 2007


Hi,
 I'm noticing very strange behaviour on JBoss Rules 4. (Havnt confirmed on 3).


Setup:
-------
1. CreateClasses
Class ChildA1 --<Extends>--> A --<Extends>--> Base
Class ChildA2 --<Extends>--> A --<Extends>--> Base
(Base has some attribute which is obviously inherited by A1 & A2)

2. Make a collection of such objects (ChildA1, ChildA2 & A)
I make a JDK 1.5 style "List<Base>", and put A1 & A2 into that.
{I was experimenting in measuring performance differce between inherited/Child 
Node types Vs using attributes on A}

3. Later I take this list and assert into a StaelessSession.

The Bug(s): (   So I think :o)  ), n please dont say its a feature... kidding!
---------------------
Rule USE CASE - I:

rule "Test A with attrib 1"
	salience 150
	no-loop true
when 
     a1: A(attrib=="type 1")
then
 ...
 drools.getActivation().remove(); 
end

rule "Test A with attrib 2"
	salience 150
	no-loop true
when 
     a1: A(attrib=="type 2")
then
 ...
 drools.getActivation().remove(); 
end

Note: There was another rule that called "modify()" to modify the state of 
another attirbute, which would cause the rule fire over the object again, so I 
used "drools.getActivation().remove(); " to ensure that once a rule fired for 
an object(activation) it would not fire for that Fact again.

The Bug --> Even if I had two instances of A, one with attrib="type 1" and the 
other with attrib = "type 2", only one would fire intermittanly for repeated 
input requests.

This would not happen if I did not use "drools.getActivation().remove(); " but 
I need to or else rules fire over the same object. But if i use it then a rule 
gets deactivated without firing.

:o(

Please Help! (I'm sure if this Case is solved or explained I'll take on the 
rest)





More information about the rules-dev mailing list