[
http://jira.jboss.com/jira/browse/JBRULES-1572?page=comments#action_12411683 ]
Mark Proctor commented on JBRULES-1572:
---------------------------------------
I've created the following unit test, based of your example:
public void testMultiThreadOnSingleSession() throws Exception {
String str = "package org.drools.test\n" +
"import org.drools.Person\n" +
"rule \"Auto Retract\"" +
"when\n" +
" person:Person()\n" +
"then\n" +
" retract(person);\n" +
"end\n";
RuleBase ruleBase = RuleBaseFactory.newRuleBase();
PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl(new StringReader( str ) );
Package pkg = builder.getPackage();
ruleBase.addPackage(pkg);
final WorkingMemory workingMemory = ruleBase.newStatefulSession();
workingMemory.addEventListener(new DebugAgendaEventListener());
Runnable runnable = new Runnable() {
public void run() {
while (true) {
workingMemory.insert(new Person( "bobba fet", 35));
workingMemory.fireAllRules();
}
}
};
Thread thread1 = new Thread(runnable, "thread1");
Thread thread2 = new Thread(runnable, "thread2");
thread1.start();
thread2.start();
Thread.sleep( 15000 );
}
However I'm not able to reproduce the problem, on my single cpu laptop. Is this a
problem that only becomes visible on multiple cpus?
sometimes getting ClassFieldExtractor error
-------------------------------------------
Key: JBRULES-1572
URL:
http://jira.jboss.com/jira/browse/JBRULES-1572
Project: JBoss Drools
Issue Type: Bug
Security Level: Public(Everyone can see)
Affects Versions: 5.0.0-M1, 4.0.4, 4.0.7
Reporter: Ming Fang
Assigned To: Mark Proctor
Attachments: Foo.java, rule.drl, Test.java, Test.java
Caused by: java.lang.NullPointerException
at org.drools.base.com.ml.ax.ModelValue10285014$getModelValue.getDoubleValue(Unknown
Source)
at org.drools.base.ClassFieldExtractor.getDoubleValue(ClassFieldExtractor.java:191)
at org.drools.rule.Declaration.getDoubleValue(Declaration.java:281)
at
com.ml.ax.drools.Rule_Quote_0ConsequenceInvoker.evaluate(Rule_Quote_0ConsequenceInvoker.java:17)
at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:586)
This only happens sometimes but it completely breaks my program.
--
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