This is more a Java question than a Drools specific problem.

You have several producers, running in threads, parallel or (more or less) one
after the other. You have one consumer, the thread running the single session.
Consuming consists of accepting the fact and inserting it into the session; then
fireAllRules must be called; then the Consumer is ready for the next fact.

Look into java.util.concurrent. One object implementing BlockingQueue<?>
is what you need for communication between producers and the consumer.
You'll have to figure out the details, depending on the runtime parameters
of your application, i.e., arrival frequency, average processing time by the
Engine, etc.


On 22 October 2010 08:10, Ayush <> wrote:

Thanks for the reply.

Can you please elaborate on it?

Well we are facing issues keeping same session and entry point alive through
out the application.

As each event will be received as a new thread in my application so when I'm
calling the class which inserts into session and fire-all rules then it's
also called as new thread and when called it again initializes the session.
I tried to prevent it by not calling session.dispose() and making it static.
For the 1st thread it works fine but for the second thread when I insert
event into entry-point I get the exception due to concurrent modification.

How can I implement it so that the session and entry-point is initialized
only once and every new event, which is a new thread, will be inserted into
the same entry-point? Also I want that prevoius facts and events should be
in drools memory because I'm working on previous alarms as well?
View this message in context:
Sent from the Drools - User mailing list archive at
rules-users mailing list