在多次执行状态执行期间,Drools引擎挂起

时间:2015-02-24 13:11:21

标签: java multithreading drools rete

对于每个请求,我创建一个新的知识会话,执行规则并最终处理它。这适用于开发环境中的少量请求。 但是在生产环境中,有多个请求时,Drools引擎会挂起以下的线程转储。

`java.lang.Thread.State: RUNNABLE
at org.drools.reteoo.JoinNodeLeftTuple.getLastHandle(JoinNodeLeftTuple.java:536)
at org.drools.reteoo.AccumulateNode.addMatch(AccumulateNode.java:862)
at org.drools.reteoo.AccumulateNode.modifyRightTuple(AccumulateNode.java:558)
at org.drools.reteoo.RightInputAdapterNode.modifyLeftTuple(RightInputAdapterNode.java:222)
at org.drools.reteoo.SingleLeftTupleSinkAdapter.propagateModifyChildLeftTuple(SingleLeftTupleSinkAdapter.java:260)
at org.drools.reteoo.FromNode.checkConstraintsAndPropagate(FromNode.java:355)
at org.drools.reteoo.FromNode.modifyLeftTuple(FromNode.java:299)
at org.drools.reteoo.CompositeLeftTupleSinkAdapter.propagateModifyChildLeftTuple(CompositeLeftTupleSinkAdapter.java:316)
at org.drools.reteoo.JoinNode.modifyRightTuple(JoinNode.java:286)
at org.drools.reteoo.BetaNode.modifyObject(BetaNode.java:429)
at org.drools.reteoo.JoinNode.modifyObject(JoinNode.java:459)
at org.drools.reteoo.SingleObjectSinkAdapter.propagateModifyObject(SingleObjectSinkAdapter.java:68)
at org.drools.reteoo.AlphaNode.modifyObject(AlphaNode.java:150)
at org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateModifyObject(CompositeObjectSinkAdapter.java:468)
at org.drools.reteoo.CompositeObjectSinkAdapter.propagateModifyObject(CompositeObjectSinkAdapter.java:436)
at org.drools.reteoo.AlphaNode.modifyObject(AlphaNode.java:150)
at org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateModifyObject(CompositeObjectSinkAdapter.java:468)
at org.drools.reteoo.CompositeObjectSinkAdapter.propagateModifyObject(CompositeObjectSinkAdapter.java:425)
at org.drools.reteoo.ObjectTypeNode.modifyObject(ObjectTypeNode.java:287)
at org.drools.reteoo.EntryPointNode.modifyObject(EntryPointNode.java:271)
at org.drools.common.NamedEntryPoint.update(NamedEntryPoint.java:467)
at org.drools.common.NamedEntryPoint.update(NamedEntryPoint.java:370)
at org.drools.base.DefaultKnowledgeHelper.update(DefaultKnowledgeHelper.java:311) 
at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1191)
 - locked <0x00000007297a2008> (a org.drools.common.DefaultAgenda)
at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:1126)
at org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1349)
at org.drools.common.AbstractWorkingMemory.fireAllRules     (AbstractWorkingMemory.java:709)
- locked <0x00000007297a1e58> (a org.drools.reteoo.ReteooStatefulSession)
at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:673)
at org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:228)
at com.healthnet.hnfs.service.rls.AuthRulesBusinessServiceImpl.runRules(AuthRulesBusinessServiceImpl.java:387)
at com.healthnet.hnfs.service.rls.AuthRulesBusinessServiceImpl.runAdjudicationRules(AuthRulesBusinessServiceImpl.java:229)
at com.healthnet.hnfs.service.rls.AuthRulesBusinessServiceImpl.processAuth(AuthRulesBusinessServiceImpl.java:208)
at sun.reflect.GeneratedMethodAccessor4101.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)`

线程转储显示JoinNodeLeftTuple.getLastHandle(JoinNodeLeftTuple.java:536)存在死锁。但是当我为每个请求创建单独的会话时,不应该发生这种线程锁定。

  1. 死锁的原因可能是什么
  2. 如何解决此问题

0 个答案:

没有答案