[rules-users] is this kind of App right for DROOLS?

Greg Barton greg_barton at yahoo.com
Thu Apr 16 01:12:16 EDT 2009


FYI, I ran the attached code using RuleBaseConfiguration.setMultithreadEvaluation(true) and it stopped working correctly.  With it false the output was as expected, something like this:

Starting init 
Finished init 
Matched 902563 
Unmatched B 47347
Time 92658ms

But with multithreaded evaluation the results were invalid:

Starting init 
Finished init 
Matched 0 
Unmatched B 0
Time 25546ms

It runs a lot faster, though. :)

Am I doing something wrong?

--- On Wed, 4/15/09, Greg Barton <greg_barton at yahoo.com> wrote:

> From: Greg Barton <greg_barton at yahoo.com>
> Subject: Re: [rules-users] is this kind of App right for DROOLS?
> To: "Rules Users List" <rules-users at lists.jboss.org>
> Date: Wednesday, April 15, 2009, 11:26 PM
> Attached is an simple implementation of what I describe
> below.  I was pleasantly surprised that it ran much faster
> than I expected, and using less memory.  At times in pegged
> all four cpu cores on my workstation.  It's nice to see
> such effective utilization of resources. (Though I did run
> it with UseParallelGC, so that may have helped.)
> 
> The only complaint I have is getting it to stop. :) 
> You've got to kill or ctrl-C to get it to halt.  I am
> calling drools.halt() in a rule that is being executed.  Is
> there another way to exit from fireUntilHalt?  The console
> messages printed by the app show that fireUntilHalt does
> exit.
> 
> I noticed on doing a thread dump that a drools thread is
> blocking after fireUntilHalt exits:
> 
> Name: Thread-2
> State: WAITING on
> java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject at 4c7e8bf0
> Total blocked: 0  Total waited: 414
> 
> Stack trace: 
> sun.misc.Unsafe.park(Native Method)
> java.util.concurrent.locks.LockSupport.park(LockSupport.java:158)
> java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:1925)
> java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:358)
> org.drools.concurrent.CommandExecutor.run(CommandExecutor.java:77)
> java.lang.Thread.run(Thread.java:619)
> 
> CommandExecutor.java line 77 is this:
> 
> Command executor = ( Command ) this.queue.take();
> 
> "queue" is a BlockingQueue, and
> BlockingQueue.take() will not exit until it returns an
> object from the queue or it's thread is interrupted. 
> Dev d00ds, is there an official way to interrupt this
> thread?
> 


      
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Sample.drl
Type: application/octet-stream
Size: 867 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/rules-users/attachments/20090415/67b413cb/attachment.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DroolsTest.java
Type: text/x-java
Size: 4154 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/rules-users/attachments/20090415/67b413cb/attachment.bin 


More information about the rules-users mailing list