[英]is newKieSession thread-safe?
We used Drools kieSessions in our project. 我们在项目中使用了Drools kieSessions。 Many threads can create new kieSession.
许多线程可以创建新的kieSession。 Sometimes thread can hang while creating session.
有时线程可以在创建会话时挂起。 Hence the question:
因此问题是:
Firstly 首先
As I checked in practice 当我在实践中检查
newKieSession
isn't thread-safe operation. 不是线程安全的操作。
I couldn't find any explicit statement in the drools documentation, but my understanding is that the KieContainer
is thread-safe and even smart enough to (somewhat silently/magically) update itself (or rather its contained KieBases). 我在drools文档中找不到任何明确的声明,但我的理解是
KieContainer
是线程安全的,甚至足够智能(有点默默/神奇地)更新自己(或者更确切地说它包含的KieBases)。
For all practical purposes (debugging/reading the source code) I think all the KieContainer.newStatelessKieSession()
and the KieContainer.newKieSession()
methods are thread-safe. 出于所有实际目的(调试/读取源代码),我认为所有
KieContainer.newStatelessKieSession()
和KieContainer.newKieSession()
方法都是线程安全的。
I am not 100% sure about the updateToVersion()
and updateDependencyToVersion()
methods and whether changing the kie container through those works in parallel with the KieContainer.newStatelessKieSession()
and newKieSession()
methods. 我不是100%确定
updateToVersion()
和updateDependencyToVersion()
方法,以及是否通过与KieContainer.newStatelessKieSession()
和newKieSession()
方法并行更改kie容器。
In our application we managed to separate the logic of modifying your rules (and modules, bases, sessions and their configuration) from the rule evaluation (which uses the newKieSession
etc methods) and things seem to be fine so far, but I'd like to understand how you came to the conclusion that it isnt thread-safe. 在我们的应用程序中,我们设法将规则(以及模块,基础,会话及其配置)的修改逻辑从规则评估(使用
newKieSession
等方法)中分离出来,到目前为止看似很好,但我想要了解你是如何得出它不是线程安全的结论。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.