Drools:可以从规则的RHS中调用查询吗?

时间:2019-01-04 10:35:25

标签: drools

我有一些代码可以在处理规则RHS上的动作时调用KieRuntime :: getQueryResults(),即在KieRuntime :: fireAllRules()中间

这通常可以工作一段时间,但是最近在某些情况下开始陷入僵局。

下面的堆栈说明了这一点(删除了一些框架)

我不确定是否完全支持这种操作,即从正在处理第一个线程的同一线程在KieSession上调用第二个操作-似乎不可以。

任何人都可以确认/发表评论吗?

谢谢。

"pool-1-thread-1@3924" prio=5 tid=0xf nid=NA waiting
  java.lang.Thread.State: WAITING
      at sun.misc.Unsafe.park(Unsafe.java:-1)
      at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
      at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:836)
      at java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedInterruptibly(AbstractQueuedSynchronizer.java:997)
      at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1304)
      at java.util.concurrent.CountDownLatch.await(CountDownLatch.java:231)
      at org.drools.core.phreak.PropagationEntry$PropagationEntryWithResult.getResult(PropagationEntry.java:117)
      at org.drools.core.impl.StatefulKnowledgeSessionImpl.evalQuery(StatefulKnowledgeSessionImpl.java:895)
      at org.drools.core.impl.StatefulKnowledgeSessionImpl.internalGetQueryResult(StatefulKnowledgeSessionImpl.java:823)
      at org.drools.core.impl.StatefulKnowledgeSessionImpl.getQueryResults(StatefulKnowledgeSessionImpl.java:783)
      at org.drools.core.impl.StatefulKnowledgeSessionImpl.getQueryResults(StatefulKnowledgeSessionImpl.java:163)
...

      at org.drools.core.phreak.RuleExecutor.innerFireActivation(RuleExecutor.java:431)
      at org.drools.core.phreak.RuleExecutor.fireActivation(RuleExecutor.java:379)
      at org.drools.core.phreak.RuleExecutor.fire(RuleExecutor.java:135)
      at org.drools.core.phreak.RuleExecutor.evaluateNetworkAndFire(RuleExecutor.java:88)
      at org.drools.core.concurrent.AbstractRuleEvaluator.internalEvaluateAndFire(AbstractRuleEvaluator.java:34)
      at org.drools.core.concurrent.SequentialRuleEvaluator.evaluateAndFire(SequentialRuleEvaluator.java:43)
      at org.drools.core.common.DefaultAgenda.fireLoop(DefaultAgenda.java:1067)
      at org.drools.core.common.DefaultAgenda.internalFireAllRules(DefaultAgenda.java:1014)
      at org.drools.core.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1006)
      at org.drools.core.impl.StatefulKnowledgeSessionImpl.internalFireAllRules(StatefulKnowledgeSessionImpl.java:1337)
      at org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:1328)
      at org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:1312)
      at 
...

0 个答案:

没有答案