jBPM 是否有用于异步工作流的固定大小的线程池?
Does jBPM have a fixed size thread pool for async workflows?
我有 jBPM 5.4,我发现无论我如何更改 standalone.xml.
我担心 jBPM 是如何通过固定池大小来做到这一点的。谁能证实或否认这一点?
免责声明:我最近没有尝试过,这是对旧项目的回忆(其中 6.0 在 horizon 上,未使用,但讨论过),并通过查看文档刷新了我的记忆。另外,我 不期望 这里 "workflows" 有什么特别之处,应该适用相同的原则。
jBPM 的引擎是 single-thread:
We've chosen to implement logical multi-threading using one thread: a jBPM process that includes logical multi-threading will only be executed in one technical thread.
对于 v5 中的异步任务,您必须自己处理线程,如文档中的示例所示:
public class MyServiceTaskHandler implements WorkItemHandler {
public void executeWorkItem(WorkItem workItem, WorkItemManager manager) {
new Thread(new Runnable() {
public void run() {
// Do the heavy lifting here ...
}
}).start();
}
public void abortWorkItem(WorkItem workItem, WorkItemManager manager) {
}
}
我的理解是,如果您不这样做,您的异步任务只是可能 异步。如果你这样做,你就无法控制并发级别。所以这是一个糟糕的例子,他们至少应该展示如何使用 ExecutorService
或一些合理的东西。
无论如何,版本 6 仍然有一个 single-thread 核心引擎,但是 offers its own executor for async workloads:
In version 6, jBPM introduces new component called jbpm executor which provides quite advanced features for asynchronous execution. It delivers generic environment for background execution of commands.
它的内部线程池可以用系统配置属性 org.kie.executor.pool.size
(在上面链接的页面底部提到)。
这已在 jBPM 6 中修复:请参阅 https://issues.jboss.org/browse/JBPM-4275
我有 jBPM 5.4,我发现无论我如何更改 standalone.xml.
我担心 jBPM 是如何通过固定池大小来做到这一点的。谁能证实或否认这一点?
免责声明:我最近没有尝试过,这是对旧项目的回忆(其中 6.0 在 horizon 上,未使用,但讨论过),并通过查看文档刷新了我的记忆。另外,我 不期望 这里 "workflows" 有什么特别之处,应该适用相同的原则。
jBPM 的引擎是 single-thread:
We've chosen to implement logical multi-threading using one thread: a jBPM process that includes logical multi-threading will only be executed in one technical thread.
对于 v5 中的异步任务,您必须自己处理线程,如文档中的示例所示:
public class MyServiceTaskHandler implements WorkItemHandler {
public void executeWorkItem(WorkItem workItem, WorkItemManager manager) {
new Thread(new Runnable() {
public void run() {
// Do the heavy lifting here ...
}
}).start();
}
public void abortWorkItem(WorkItem workItem, WorkItemManager manager) {
}
}
我的理解是,如果您不这样做,您的异步任务只是可能 异步。如果你这样做,你就无法控制并发级别。所以这是一个糟糕的例子,他们至少应该展示如何使用 ExecutorService
或一些合理的东西。
无论如何,版本 6 仍然有一个 single-thread 核心引擎,但是 offers its own executor for async workloads:
In version 6, jBPM introduces new component called jbpm executor which provides quite advanced features for asynchronous execution. It delivers generic environment for background execution of commands.
它的内部线程池可以用系统配置属性 org.kie.executor.pool.size
(在上面链接的页面底部提到)。
这已在 jBPM 6 中修复:请参阅 https://issues.jboss.org/browse/JBPM-4275