[JBoss JIRA] Created: (JBRULES-1410) Rules with Collect / Accumulate CEs not working correctly when dinamically added to a rulebase
by Edson Tirelli (JIRA)
Rules with Collect / Accumulate CEs not working correctly when dinamically added to a rulebase
----------------------------------------------------------------------------------------------
Key: JBRULES-1410
URL: http://jira.jboss.com/jira/browse/JBRULES-1410
Project: JBoss Drools
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: Reteoo
Affects Versions: 4.0.3
Reporter: Edson Tirelli
Assigned To: Edson Tirelli
Fix For: 4.0.4, 4.1.0
Reported by Dirk:
--------------------------
I have modified my application to allow adding/removing/updating rules during
runtime. However, when I add a new rule to the rulebase, I don't get the
behavior I expect.
First, as soon as I call RuleBase.addPackage(), the new rules fire (the RHS code
runs). Shouldn't that happen only when I call fireAllRules()?
Second, newly added collect() rules don't collect already asserted objects. New
non-collect rules can see the objects just fine.
Attached is a testcase, and below is the output it produces. Am I doing
something wrong, or is this a bug? I'm running Drools 4.0.3 on JDK 1.5.0.13.
Start
RuleBase created
Adding rules about 'tom':
package rules;
import java.util.ArrayList;
import test.Tester.Record;
import test.Tester;
rule "Collect tom"
when
$list : ArrayList(size > 0) from collect( Record(field1 == "tom") )
then
Tester.show($list, "Collect tom");
end
rule "Non collect tom"
when
$rec : Record( field1 == "tom" )
then
System.out.println("Find 'tom' " + $rec.dump());
end
inserting record 1:"tom",
inserting record 2:"fred",
inserting record 3:"harry",
inserting record 4:"fred",
inserting record 5:"ed",
inserting record 6:"tom",
inserting record 7:"sreeni",
inserting record 8:"jill",
inserting record 9:"ralph",
inserting record 10:"tom",
fireAllRules()
Find 'tom' 10:"tom",
'Collect tom' collected 3 records => 1:"tom", 6:"tom", 10:"tom",
Find 'tom' 6:"tom",
Find 'tom' 1:"tom",
adding rules about 'fred':
package morerules;
import java.util.ArrayList;
import test.Tester.Record;
import test.Tester;
rule "Collect fred"
when
$list : ArrayList(size > 0) from collect( Record(field1 == "fred") )
then
Tester.show($list, "Collect fred");
end
rule "Non collect fred"
when
$rec : Record( field1 == "fred" )
then
System.out.println("Find 'fred' " + $rec.dump());
end
==> Why do the new rules fire when added?
Find 'fred' 4:"fred",
Find 'fred' 2:"fred",
'Collect fred' collected 0 records =>
==> Why doesn't the collect rule collect? The non-collect rule works.
fireAllRules()
Changing record 3 to 'fred'
fireAllRules()
Find 'fred' 3:"fred",
'Collect fred' collected 1 records => 3:"fred",
==> Why does the collect rule not see the other two 'fred' records?
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
16 years, 11 months
[JBoss JIRA] Created: (JBRULES-1397) org.mvel.CompileException: variable already defined within scope
by Edson Tirelli (JIRA)
org.mvel.CompileException: variable already defined within scope
----------------------------------------------------------------
Key: JBRULES-1397
URL: http://jira.jboss.com/jira/browse/JBRULES-1397
Project: JBoss Drools
Issue Type: Bug
Security Level: Public (Everyone can see)
Affects Versions: 4.0.3
Reporter: Edson Tirelli
Assigned To: Edson Tirelli
Fix For: 4.0.4, 4.1.0
Reported by Alexander Bagerman.
The following rule and code snippet raises the problem:
rule "rule"
dialect "mvel"
when
$p : Person( $likes : likes )
then
Cheese c = new Cheese( $likes );
System.out.println( $p + " -> " + c );
insert( c );
end
// snippet
Person bob = new Person( "Bob", "stilton" );
Person mark = new Person( "Mark", "brie" );
workingMemory.insert( bob );
workingMemory.insert( mark );
workingMemory.fireAllRules();
The exception is:
Caused by: org.mvel.CompileException: variable already defined within scope: class com.sample.Cheese c
at org.drools.base.mvel.DroolsMVELFactory.createVariable(DroolsMVELFactory.java:218)
at org.mvel.ast.TypedVarNode.getReducedValueAccelerated(TypedVarNode.java:43)
at org.mvel.MVELRuntime.execute(MVELRuntime.java:88)
at org.mvel.CompiledExpression.getValue(CompiledExpression.java:108)
at org.mvel.MVEL.executeExpression(MVEL.java:235)
at org.drools.base.mvel.MVELConsequence.evaluate(MVELConsequence.java:47)
at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:550)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
16 years, 11 months
[JBoss JIRA] Created: (JBCACHE-1226) State transfer doesn't clean out persistent store if size of transferred persistent state is 0
by Brian Stansberry (JIRA)
State transfer doesn't clean out persistent store if size of transferred persistent state is 0
----------------------------------------------------------------------------------------------
Key: JBCACHE-1226
URL: http://jira.jboss.com/jira/browse/JBCACHE-1226
Project: JBoss Cache
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: Cache loaders
Affects Versions: 1.4.1.SP7
Reporter: Brian Stansberry
Assigned To: Manik Surtani
Priority: Minor
StateTransferIntegrator_140.integratePersistentState() is a no-op if the size of the provided persistent state is 0. So, if persistent state transfer is enabled but the provider doesn't have any persistent state to transfer, any stale persistent state laying around on the recipient will not get cleaned up.
A fix for this needs to properly discriminate between the above case and one where no persistent state is available because persistent state transfer is disabled.
Manik, I found this when a solution to an EJB3 bug didn't work as expected. I can tweak my solution to get around it, so this isn't urgent for me. Feel free to assign to me, although I likely won't get to it for a long time.
This likely affects all releases in the 1.x series. A *quick* look at how this works leads me to expect it's not an issue in 2.x.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
16 years, 11 months