[jboss-jira] [JBoss JIRA] (DROOLS-1228) Entry point update halts the rule Engine
Mario Fusco (JIRA)
issues at jboss.org
Wed Jul 27 10:55:00 EDT 2016
[ https://issues.jboss.org/browse/DROOLS-1228?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mario Fusco closed DROOLS-1228.
-------------------------------
Resolution: Cannot Reproduce Bug
I tried to reproduce what you described with the test case I'm pasting below, but it works for me. If you're still having this issue please create a complete reproducer (maybe reusing part of what I did) attach it to this ticket and reopen the ticket.
{code}
@Test
public void testUpdateDuringFireUntilHalt() throws Exception {
String drl =
"import " + AtomicInteger.class.getCanonicalName() + ";\n" +
"import " + BlockingQueue.class.getCanonicalName() + ";\n" +
"global BlockingQueue queue;\n" +
"rule R1 when\n" +
" $i: Integer(this > 0) \n" +
"then " +
" delete($i);" +
"end\n" +
"rule R2 when\n" +
" $i: AtomicInteger(get() == 0 || get() == 2) \n" +
"then " +
" modify($i) { set( $i.get() + 1 ) };" +
" queue.put($i);" +
"end\n";
final KieSession ksession = new KieHelper().addContent( drl, ResourceType.DRL )
.build()
.newKieSession();
BlockingQueue<AtomicInteger> queue = new LinkedBlockingQueue<AtomicInteger>();
ksession.setGlobal("queue", queue);
new Thread () {
public void run () {
ksession.fireUntilHalt();
}
}.start();
new Thread () {
public void run () {
// keep the engine busy
for (int i = 1; i < 1000000; i++) {
ksession.insert( i );
}
}
}.start();
AtomicInteger obj = new AtomicInteger(0);
FactHandle fh = ksession.insert( obj );
for (int i = 0; i < 2; i++) {
AtomicInteger aInt = queue.take();
if (aInt.get() % 2 == 0) {
fail(aInt + " should be odd");
}
aInt.set(aInt.get()+1);
ksession.update( fh, aInt );
}
ksession.halt();
assertEquals( 4, obj.get() );
}
{code}
> Entry point update halts the rule Engine
> ----------------------------------------
>
> Key: DROOLS-1228
> URL: https://issues.jboss.org/browse/DROOLS-1228
> Project: Drools
> Issue Type: Bug
> Components: core engine
> Affects Versions: 6.3.0.Final
> Environment: Linux, JBOSS 6.3 EAP, Java 8, Drools 6.2
> Reporter: mithun singh
> Assignee: Mario Fusco
> Priority: Blocker
> Attachments: structure.png
>
>
> 1. A Stateful session is created.
> 2. Facts are loaded to stateful session and after successful loading into session we initiate "*fireUntilHault()*" inorder to fire the rules, where we have about 38 rules.
> 3. We have configured a queue inorder to receive messages from source system and load the relevant facts into the session by retrieving the entry point from the session, update the fact and set focus to the relevant agenda group.
> 4. We are not able to update the fact using *"EntryPoint.update(Fact)"*. We could see that this occurs if the rule Engine starts firing facts and we subsequently update the fact in the session.
> 5. According to drools, rule engine will handle the sequence of updates and firing of rules accordingly.
> 6. But rule engine comes to halt state and there is no exception related to this.
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
More information about the jboss-jira
mailing list