I use a Ruleagent with the following params

(rules.properties):

localCacheDir=…

url=…

poll=30

name=eventexpertrules

 

Here is my session initialization:

 

RuleAgent agent = RuleAgent.newRuleAgent("/rules.properties");

RuleBase retValue = agent.getRuleBase();

final RuleBase ruleBase = agent.getRuleBase();

session = ruleBase.newStatefulSession();

DroolsLogger drlogger = new DroolsLogger(session); // add logger          

//Insert Event Processor Instance as global

session.setGlobal("processor", this);

 

 

Here is the stack trace of the thread that updates the rule base

 

"Timer-2" daemon prio=3 tid=0x0000000002356800 nid=0x24 waiting for monitor entry [0xfffffd7fe28b7000..0xfffffd7fe28b7a20]

   java.lang.Thread.State: BLOCKED (on object monitor)

        at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:433)

        - waiting to lock <0xfffffd7feb474680> (a org.drools.reteoo.ReteooStatefulSession)

        at org.drools.base.FireAllRulesRuleBaseUpdateListener.beforeRuleBaseUnlocked(FireAllRulesRuleBaseUpdateListener.java:29)

        at org.drools.event.RuleBaseEventSupport.fireBeforeRuleBaseUnlocked(RuleBaseEventSupport.java:168)

        at org.drools.common.AbstractRuleBase.unlock(AbstractRuleBase.java:351)

        at org.drools.agent.PackageProvider.applyChanges(PackageProvider.java:73)

        at org.drools.agent.RuleAgent.refreshRuleBase(RuleAgent.java:320)

        at org.drools.agent.RuleAgent$2.run(RuleAgent.java:438)

        at java.util.TimerThread.mainLoop(Timer.java:512)

        at java.util.TimerThread.run(Timer.java:462)

 

 

Here is the stack trace of my application that basically inserts facts and fires rules …

 

"ActiveMQ Session Task" daemon prio=3 tid=0x0000000002564400 nid=0x142e in Object.wait() [0xfffffd7fe01dd000..0xfffffd7fe01ddaa0]

   java.lang.Thread.State: WAITING (on object monitor)

        at java.lang.Object.wait(Native Method)

        - waiting on <0xfffffd7feb49a9e0> (a org.drools.util.concurrent.locks.ReentrantLock$NonfairSync)

        at java.lang.Object.wait(Object.java:485)

        at org.drools.util.concurrent.locks.ReentrantLock$NonfairSync.lock(ReentrantLock.java:106)

        - locked <0xfffffd7feb49a9e0> (a org.drools.util.concurrent.locks.ReentrantLock$NonfairSync)

        at org.drools.util.concurrent.locks.ReentrantLock.lock(ReentrantLock.java:195)

        at org.drools.common.AbstractWorkingMemory.getGlobal(AbstractWorkingMemory.java:397)

        at com.daxtechnologies.optima.fault.eventprocessor.Rule_EventForwarder_0ConsequenceInvoker.evaluate(Unknown Source)

        at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:550)

        - locked <0xfffffd7feb49a3f8> (a org.drools.common.DefaultAgenda)

        at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:514)

        at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:471)

        - locked <0xfffffd7feb474680> (a org.drools.reteoo.ReteooStatefulSession)

        at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:433)

        - locked <0xfffffd7feb474680> (a org.drools.reteoo.ReteooStatefulSession)

        at com.daxtechnologies.optima.fault.eventprocessor.fault.level2.maps.EventExpertProcessor.processEventVO(EventExpertProcessor.java:147)

        - locked <0xfffffd7feb474a18> (a com.daxtechnologies.optima.fault.eventprocessor.fault.level2.maps.EventExpertProcessor)

        at com.daxtechnologies.optima.fault.eventprocessor.fault.level2.maps.EventExpertProcessor.doProcessEvent(EventExpertProcessor.java:70)

 

 

As you see both threads wait for something…

 

thanks

 

--zoly