code review

This commit is contained in:
jason
2024-11-04 10:44:54 +08:00
parent 3fbd8e1c8e
commit e9e293fdbe
3 changed files with 11 additions and 5 deletions

View File

@@ -127,10 +127,10 @@ public abstract class ParallelStrategyExecutor {
protected ExecutorService getWhenExecutorService(WhenCondition whenCondition, Integer slotIndex) {
LiteflowConfig liteflowConfig = LiteflowConfigGetter.get();
// 如果设置了线程池隔离,则每个 when 都会有对应的线程池,这是为了避免多层嵌套时如果线程池数量不够时出现单个线程池死锁。用线程池隔离的方式会更加好
// 如果 when 没有超多层的嵌套,还是用默认的比较好。
// 默认设置不隔离。也就是说,默认情况是一个线程池类一个实例,如果什么都不配置,那也就是在 when 的情况下,全局一个线程池
//线程池的优先级 condition层级>chain层级>全局体系
// 1、如果设置了线程池隔离,则每个 when 都会有对应的线程池,这是为了避免多层嵌套时如果线程池数量不够时出现单个线程池死锁。用线程池隔离的方式会更加好
// 2、如果在chain上自定义线程池同一个chain下的when+异步线程池共享一个线程池
// 3、默认全局一个线程池所有的when+异步共享一个线程池
ExecutorService parallelExecutor;
String chainId = DataBus.getSlot(slotIndex).getChainId();

View File

@@ -344,7 +344,8 @@ public class ParserHelper {
e.attributeValue(THREAD_POOL_EXECUTOR_CLASS);
LiteFlowChainELBuilder builder =
LiteFlowChainELBuilder.createChain().setChainId(chainId).setNamespace(namespace).setThreadPoolExecutorClass(threadPoolExecutorClass);
LiteFlowChainELBuilder.createChain().setChainId(chainId).setNamespace(namespace)
.setThreadPoolExecutorClass(threadPoolExecutorClass);
// 如果有route这个标签说明是决策表chain
// 决策表链路必须有route和body这两个标签

View File

@@ -137,6 +137,11 @@ public class ExecutorHelper {
String chainId = DataBus.getSlot(slotIndex).getChainId();
Chain chain = FlowBus.getChain(chainId);
//线程池的优先级 condition层级>chain层级>全局体系
// 1、如果设置了线程池隔离则每个 异步 都会有对应的线程池,这是为了避免多层嵌套时如果线程池数量不够时出现单个线程池死锁。用线程池隔离的方式会更加好
// 2、如果在chain上自定义线程池同一个chain下的when+异步线程池共享一个线程池
// 3、默认全局一个线程池所有的when+异步共享一个线程池
if (ObjectUtil.isNotEmpty(loopCondition.getThreadPoolExecutorClass())) {
//condition层级线程池
parallelExecutor = getExecutorService(loopCondition.getThreadPoolExecutorClass(),