如何在 Drools Flow 中启动多个进程?
我想启动多个 Drools Flow 进程,但此代码阻塞:
ksession.startProcess( "com.sample.ruleflow" );
我该如何执行此操作?
I want to start mutliple Drools Flow processes, but this code blocks:
ksession.startProcess( "com.sample.ruleflow" );
How can I do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
StatefulKnowledgeSession.startProcess()
仅在达到等待状态时才会阻塞。如果您希望进程完全异步运行,那么您需要从另一个线程调用
startProcess()
。然而,对于一个非常简单的进程(没有可能的等待状态),它很可能会在当前线程中执行下一行代码之前开始和结束,给人一种阻塞行为的印象,而实际上没有阻塞行为。
StatefulKnowledgeSession.startProcess()
blocks only when it reaches a wait state.If you want the process to run completely asynchronously then you will need to call
startProcess()
from another thread.However, with a very simple process (with no possible wait states) it is likely that it will start and end before the next line of code is executed in the current thread, giving an impression of blocking behaviour where in fact there is none.