remove code && add springBoot test

This commit is contained in:
jason
2024-11-01 11:54:01 +08:00
parent a27397c9d4
commit 3fbd8e1c8e
28 changed files with 50 additions and 366 deletions

View File

@@ -35,7 +35,7 @@ public class ThreadPoolOperator extends BaseOperator<Condition> {
condition.setThreadPoolExecutorClass(OperatorHelper.convert(objects[1], String.class));
return condition;
} else {
String errorMsg = "The caller must be LoopCondition or WhenCondition item";
String errorMsg = "The caller must be WhenCondition or LoopCondition item";
throw new QLException(errorMsg);
}
}

View File

@@ -7,8 +7,6 @@ import com.yomahub.liteflow.flow.element.condition.WhenCondition;
import com.yomahub.liteflow.property.LiteflowConfig;
import com.yomahub.liteflow.property.LiteflowConfigGetter;
import java.util.Optional;
/**
* EL规则中的WHEN的操作符
*
@@ -27,8 +25,7 @@ public class WhenOperator extends BaseOperator<WhenCondition> {
for (Object obj : objects) {
OperatorHelper.checkObjMustBeCommonTypeItem(obj);
whenCondition.addExecutable(OperatorHelper.convert(obj, Executable.class));
whenCondition.setThreadExecutorClass(Optional.ofNullable(liteflowConfig.getThreadExecutorClass())
.orElse(liteflowConfig.getGlobalThreadPoolExecutorClass()));
whenCondition.setThreadExecutorClass(liteflowConfig.getGlobalThreadPoolExecutorClass());
}
return whenCondition;
}

View File

@@ -304,8 +304,8 @@ public class ParserHelper {
JsonNode routeJsonNode = chainNode.get(ROUTE);
String threadPoolExecutorClass = chainNode.get(THREAD_POOL_EXECUTOR_CLASS) == null ?
null : chainNode.get(THREAD_POOL_EXECUTOR_CLASS).textValue();
String threadPoolExecutorClass = chainNode.get(THREAD_POOL_EXECUTOR_CLASS) == null ? null :
chainNode.get(THREAD_POOL_EXECUTOR_CLASS).textValue();
LiteFlowChainELBuilder builder =
LiteFlowChainELBuilder.createChain().setChainId(chainId).setNamespace(namespace)
@@ -340,12 +340,11 @@ public class ParserHelper {
Element routeElement = e.element(ROUTE);
String threadPoolExecutorClass = e.attributeValue(THREAD_POOL_EXECUTOR_CLASS) == null ?
null : e.attributeValue(THREAD_POOL_EXECUTOR_CLASS);
String threadPoolExecutorClass = e.attributeValue(THREAD_POOL_EXECUTOR_CLASS) == null ? null :
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

@@ -41,10 +41,6 @@ public class LiteflowConfig {
// slot的数量
private Integer slotSize;
// 并行线程执行器class路径
@Deprecated
private String threadExecutorClass;
// 异步线程最大等待秒数
@Deprecated
private Integer whenMaxWaitSeconds;
@@ -68,10 +64,6 @@ public class LiteflowConfig {
// 每隔多少秒打印
private Long period;
// 异步线程池最大线程数
@Deprecated
private Integer whenMaxWorkers;
// 异步线程池最大队列数量
@Deprecated
private Integer whenQueueLimit;
@@ -107,18 +99,6 @@ public class LiteflowConfig {
// 规则文件/脚本文件变更监听
private Boolean enableMonitorFile = Boolean.FALSE;
//并行循环线程池所用class路径
@Deprecated
private String parallelLoopExecutorClass;
//使用默认并行循环线程池时,最大线程数
@Deprecated
private Integer parallelMaxWorkers;
//使用默认并行循环线程池时,最大队列数
@Deprecated
private Integer parallelQueueLimit;
// 是否启用组件降级
private Boolean fallbackCmpEnable;
@@ -245,37 +225,6 @@ public class LiteflowConfig {
this.enableLog = enableLog;
}
@Deprecated
public Integer getWhenMaxWorkers() {
if (ObjectUtil.isNull(whenMaxWorkers)) {
return 16;
}
else {
return whenMaxWorkers;
}
}
@Deprecated
public void setWhenMaxWorkers(Integer whenMaxWorkers) {
this.whenMaxWorkers = whenMaxWorkers;
}
@Deprecated
public Integer getWhenQueueLimit() {
if (ObjectUtil.isNull(whenQueueLimit)) {
return 512;
}
else {
return whenQueueLimit;
}
}
@Deprecated
public void setWhenQueueLimit(Integer whenQueueLimit) {
this.whenQueueLimit = whenQueueLimit;
}
public Boolean isSupportMultipleType() {
if (ObjectUtil.isNull(supportMultipleType)) {
return Boolean.FALSE;
@@ -317,20 +266,6 @@ public class LiteflowConfig {
this.printBanner = printBanner;
}
@Deprecated
public String getThreadExecutorClass() {
if (StrUtil.isBlank(threadExecutorClass)) {
return "com.yomahub.liteflow.thread.LiteFlowDefaultWhenExecutorBuilder";
}
else {
return threadExecutorClass;
}
}
@Deprecated
public void setThreadExecutorClass(String threadExecutorClass) {
this.threadExecutorClass = threadExecutorClass;
}
public String getNodeExecutorClass() {
if (StrUtil.isBlank(nodeExecutorClass)) {
@@ -432,47 +367,6 @@ public class LiteflowConfig {
public void setWhenMaxWaitTimeUnit(TimeUnit whenMaxWaitTimeUnit) {
this.whenMaxWaitTimeUnit = whenMaxWaitTimeUnit;
}
public Integer getParallelMaxWorkers() {
if(ObjectUtil.isNull(parallelMaxWorkers)){
return 16;
}else{
return parallelMaxWorkers;
}
}
public void setParallelMaxWorkers(Integer parallelMaxWorkers) {
this.parallelMaxWorkers = parallelMaxWorkers;
}
@Deprecated
public Integer getParallelQueueLimit() {
if(ObjectUtil.isNull(parallelQueueLimit)){
return 512;
}else{
return parallelQueueLimit;
}
}
@Deprecated
public void setParallelQueueLimit(Integer parallelQueueLimit) {
this.parallelQueueLimit = parallelQueueLimit;
}
@Deprecated
public String getParallelLoopExecutorClass() {
if (StrUtil.isBlank(parallelLoopExecutorClass)) {
return "com.yomahub.liteflow.thread.LiteFlowDefaultParallelLoopExecutorBuilder";
}
else {
return parallelLoopExecutorClass;
}
}
@Deprecated
public void setParallelLoopExecutorClass(String parallelLoopExecutorClass) {
this.parallelLoopExecutorClass = parallelLoopExecutorClass;
}
public Boolean getFallbackCmpEnable() {
if (ObjectUtil.isNull(this.fallbackCmpEnable)) {

View File

@@ -23,7 +23,6 @@ import com.yomahub.liteflow.slot.DataBus;
import com.yomahub.liteflow.spi.holder.ContextAwareHolder;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.TimeUnit;
@@ -93,8 +92,7 @@ public class ExecutorHelper {
// 构建默认when线程池
public ExecutorService buildWhenExecutor() {
LiteflowConfig liteflowConfig = LiteflowConfigGetter.get();
return buildWhenExecutor(Optional.ofNullable(liteflowConfig.getGlobalThreadPoolExecutorClass())
.orElse(liteflowConfig.getThreadExecutorClass()));
return buildWhenExecutor(liteflowConfig.getGlobalThreadPoolExecutorClass());
}
// 构建when线程池 - 支持多个when公用一个线程池
@@ -108,9 +106,7 @@ public class ExecutorHelper {
// 构建when线程池 - clazz和condition的hash值共同作为缓存key
public ExecutorService buildWhenExecutorWithHash(String conditionHash) {
LiteflowConfig liteflowConfig = LiteflowConfigGetter.get();
return buildWhenExecutorWithHash(Optional.ofNullable(liteflowConfig.getThreadExecutorClass())
.orElse(liteflowConfig.getGlobalThreadPoolExecutorClass()),
conditionHash);
return buildWhenExecutorWithHash(liteflowConfig.getGlobalThreadPoolExecutorClass(), conditionHash);
}
// 构建when线程池 - clazz和condition的hash值共同作为缓存key
@@ -138,12 +134,11 @@ public class ExecutorHelper {
public ExecutorService buildLoopParallelExecutor(LoopCondition loopCondition, Integer slotIndex) {
ExecutorService parallelExecutor;
LiteflowConfig liteflowConfig = LiteflowConfigGetter.get();
//获取chain的hash
String chainId = DataBus.getSlot(slotIndex).getChainId();
Chain chain = FlowBus.getChain(chainId);
//condition层级线程池
if (ObjectUtil.isNotEmpty(loopCondition.getThreadPoolExecutorClass())) {
//condition层级线程池
parallelExecutor = getExecutorService(loopCondition.getThreadPoolExecutorClass(),
String.valueOf(loopCondition.hashCode()));
@@ -154,8 +149,7 @@ public class ExecutorHelper {
} else {
//全局线程池
parallelExecutor = getExecutorService(Optional.ofNullable(liteflowConfig.getParallelLoopExecutorClass())
.orElse(liteflowConfig.getGlobalThreadPoolExecutorClass()));
parallelExecutor = getExecutorService(liteflowConfig.getGlobalThreadPoolExecutorClass());
}

View File

@@ -7,7 +7,7 @@ import com.yomahub.liteflow.property.LiteflowConfigGetter;
import java.util.concurrent.ExecutorService;
/**
* LiteFlow默认的when线程池+异步多线程执行器实现
* LiteFlow默认全局线程池执行器实现
*
* @author jason
*/

View File

@@ -1,27 +0,0 @@
package com.yomahub.liteflow.thread;
import cn.hutool.core.util.ObjectUtil;
import com.yomahub.liteflow.property.LiteflowConfig;
import com.yomahub.liteflow.property.LiteflowConfigGetter;
import java.util.concurrent.ExecutorService;
/**
* LiteFlow默认的并行循环执行器实现
*
* @author zhhhhy
* @since 2.11.0
*/
public class LiteFlowDefaultParallelLoopExecutorBuilder implements ExecutorBuilder {
@Override
public ExecutorService buildExecutor() {
LiteflowConfig liteflowConfig = LiteflowConfigGetter.get();
// 只有在非spring的场景下liteflowConfig才会为null
if (ObjectUtil.isNull(liteflowConfig)) {
liteflowConfig = new LiteflowConfig();
}
return buildDefaultExecutor(liteflowConfig.getParallelMaxWorkers(), liteflowConfig.getParallelMaxWorkers(),
liteflowConfig.getParallelQueueLimit(), "loop-thread-");
}
}

View File

@@ -1,28 +0,0 @@
package com.yomahub.liteflow.thread;
import cn.hutool.core.util.ObjectUtil;
import com.yomahub.liteflow.property.LiteflowConfig;
import com.yomahub.liteflow.property.LiteflowConfigGetter;
import java.util.concurrent.*;
/**
* LiteFlow默认的并行多线程执行器实现
*
* @author Bryan.Zhang
* @since 2.6.6
*/
public class LiteFlowDefaultWhenExecutorBuilder implements ExecutorBuilder {
@Override
public ExecutorService buildExecutor() {
LiteflowConfig liteflowConfig = LiteflowConfigGetter.get();
// 只有在非spring的场景下liteflowConfig才会为null
if (ObjectUtil.isNull(liteflowConfig)) {
liteflowConfig = new LiteflowConfig();
}
return buildDefaultExecutor(liteflowConfig.getWhenMaxWorkers(), liteflowConfig.getWhenMaxWorkers(),
liteflowConfig.getWhenQueueLimit(), "when-thread-");
}
}

View File

@@ -29,14 +29,11 @@ public class LiteflowAutoConfiguration {
liteflowConfig.setRuleSourceExtData(property.getRuleSourceExtData());
liteflowConfig.setRuleSourceExtDataMap(property.getRuleSourceExtDataMap());
liteflowConfig.setSlotSize(property.getSlotSize());
liteflowConfig.setThreadExecutorClass(property.getThreadExecutorClass());
liteflowConfig.setWhenMaxWaitSeconds(property.getWhenMaxWaitSeconds());
liteflowConfig.setEnableLog(liteflowMonitorProperty.isEnableLog());
liteflowConfig.setQueueLimit(liteflowMonitorProperty.getQueueLimit());
liteflowConfig.setDelay(liteflowMonitorProperty.getDelay());
liteflowConfig.setPeriod(liteflowMonitorProperty.getPeriod());
liteflowConfig.setWhenMaxWorkers(property.getWhenMaxWorkers());
liteflowConfig.setWhenQueueLimit(property.getWhenQueueLimit());
liteflowConfig.setParseMode(property.getParseMode());
liteflowConfig.setEnable(property.isEnable());
liteflowConfig.setSupportMultipleType(property.isSupportMultipleType());
@@ -47,9 +44,6 @@ public class LiteflowAutoConfiguration {
liteflowConfig.setMainExecutorWorks(property.getMainExecutorWorks());
liteflowConfig.setMainExecutorClass(property.getMainExecutorClass());
liteflowConfig.setPrintExecutionLog(property.isPrintExecutionLog());
liteflowConfig.setParallelMaxWorkers(property.getParallelMaxWorkers());
liteflowConfig.setParallelQueueLimit(property.getParallelQueueLimit());
liteflowConfig.setParallelLoopExecutorClass(property.getParallelLoopExecutorClass());
liteflowConfig.setFallbackCmpEnable(property.isFallbackCmpEnable());
liteflowConfig.setGlobalThreadPoolExecutorClass(property.getGlobalThreadPoolExecutorClass());
liteflowConfig.setGlobalThreadPoolSize(property.getGlobalThreadPoolSize());

View File

@@ -85,13 +85,13 @@ public class LiteflowProperty {
// 是否启用组件降级
private Boolean fallbackCmpEnable;
//全局线程池所用class路径(when+异步循环)
//全局线程池所用class路径
private String globalThreadPoolExecutorClass;
//全局线程池最大线程数(when+异步循环)
//全局线程池最大线程数
private Integer globalThreadPoolSize;
//全局线程池最大队列数(when+异步循环)
//全局线程池最大队列数
private Integer globalThreadPoolQueueSize;
public boolean isEnable() {

View File

@@ -4,10 +4,7 @@ liteflow.slot-size=1024
liteflow.main-executor-works=64
liteflow.main-executor-class=com.yomahub.liteflow.thread.LiteFlowDefaultMainExecutorBuilder
liteflow.request-id-generator-class=com.yomahub.liteflow.flow.id.DefaultRequestIdGenerator
liteflow.thread-executor-class=com.yomahub.liteflow.thread.LiteFlowDefaultWhenExecutorBuilder
liteflow.when-max-wait-seconds=15
liteflow.when-max-workers=16
liteflow.when-queue-limit=512
liteflow.parse-on-start=true
liteflow.retry-count=0
liteflow.support-multiple-type=false
@@ -18,3 +15,6 @@ liteflow.monitor.queue-limit=200
liteflow.monitor.delay=300000
liteflow.monitor.period=300000
liteflow.fallback-cmp-enable=false
liteflow.global-thread-pool-size=16
liteflow.global-thread-pool-queue-size=512
liteflow.global-thread-pool-executor-class=com.yomahub.liteflow.thread.LiteFlowDefaultGlobalExecutorBuilder

View File

@@ -37,10 +37,6 @@ public class LiteflowProperty {
// FlowExecutor的execute2Future的自定义线程池
private String mainExecutorClass;
// 并行线程执行器class路径
@Deprecated
private String threadExecutorClass;
// 异步线程最大等待描述
@Deprecated
private int whenMaxWaitSeconds;
@@ -49,14 +45,6 @@ public class LiteflowProperty {
private TimeUnit whenMaxWaitTimeUnit;
// 异步线程池最大线程数
@Deprecated
private int whenMaxWorkers;
// 异步线程池最大队列数量
@Deprecated
private int whenQueueLimit;
// 异步线程池是否隔离
private boolean whenThreadPoolIsolate;
@@ -85,16 +73,6 @@ public class LiteflowProperty {
// 规则文件/脚本文件变更监听
private boolean enableMonitorFile;
@Deprecated
private String parallelLoopExecutorClass;
//使用默认并行循环线程池时,最大线程数
@Deprecated
private int parallelMaxWorkers;
//使用默认并行循环线程池时,最大队列数
@Deprecated
private int parallelQueueLimit;
// 是否启用组件降级
private boolean fallbackCmpEnable;
@@ -159,26 +137,6 @@ public class LiteflowProperty {
this.whenMaxWaitSeconds = whenMaxWaitSeconds;
}
@Deprecated
public int getWhenMaxWorkers() {
return whenMaxWorkers;
}
@Deprecated
public void setWhenMaxWorkers(int whenMaxWorkers) {
this.whenMaxWorkers = whenMaxWorkers;
}
@Deprecated
public int getWhenQueueLimit() {
return whenQueueLimit;
}
@Deprecated
public void setWhenQueueLimit(int whenQueueLimit) {
this.whenQueueLimit = whenQueueLimit;
}
public ParseModeEnum getParseMode() {
return parseMode;
}
@@ -213,16 +171,6 @@ public class LiteflowProperty {
this.printBanner = printBanner;
}
@Deprecated
public String getThreadExecutorClass() {
return threadExecutorClass;
}
@Deprecated
public void setThreadExecutorClass(String threadExecutorClass) {
this.threadExecutorClass = threadExecutorClass;
}
public String getNodeExecutorClass() {
return nodeExecutorClass;
}
@@ -295,36 +243,6 @@ public class LiteflowProperty {
this.whenMaxWaitTimeUnit = whenMaxWaitTimeUnit;
}
@Deprecated
public String getParallelLoopExecutorClass() {
return parallelLoopExecutorClass;
}
@Deprecated
public void setParallelLoopExecutorClass(String parallelLoopExecutorClass) {
this.parallelLoopExecutorClass = parallelLoopExecutorClass;
}
@Deprecated
public int getParallelMaxWorkers() {
return parallelMaxWorkers;
}
@Deprecated
public void setParallelMaxWorkers(int parallelMaxWorkers) {
this.parallelMaxWorkers = parallelMaxWorkers;
}
@Deprecated
public int getParallelQueueLimit() {
return parallelQueueLimit;
}
@Deprecated
public void setParallelQueueLimit(int parallelQueueLimit) {
this.parallelQueueLimit = parallelQueueLimit;
}
public boolean isFallbackCmpEnable() {
return fallbackCmpEnable;
}

View File

@@ -26,12 +26,9 @@ public class LiteflowPropertyAutoConfiguration {
liteflowConfig.setRuleSourceExtData(property.getRuleSourceExtData());
liteflowConfig.setRuleSourceExtDataMap(property.getRuleSourceExtDataMap());
liteflowConfig.setSlotSize(property.getSlotSize());
liteflowConfig.setThreadExecutorClass(property.getThreadExecutorClass());
liteflowConfig.setWhenMaxWaitSeconds(property.getWhenMaxWaitSeconds());
liteflowConfig.setWhenMaxWaitTime(property.getWhenMaxWaitTime());
liteflowConfig.setWhenMaxWaitTimeUnit(property.getWhenMaxWaitTimeUnit());
liteflowConfig.setWhenMaxWorkers(property.getWhenMaxWorkers());
liteflowConfig.setWhenQueueLimit(property.getWhenQueueLimit());
liteflowConfig.setWhenThreadPoolIsolate(property.isWhenThreadPoolIsolate());
liteflowConfig.setParseMode(property.getParseMode());
liteflowConfig.setEnable(property.isEnable());
@@ -44,9 +41,6 @@ public class LiteflowPropertyAutoConfiguration {
liteflowConfig.setMainExecutorClass(property.getMainExecutorClass());
liteflowConfig.setPrintExecutionLog(property.isPrintExecutionLog());
liteflowConfig.setEnableMonitorFile(property.isEnableMonitorFile());
liteflowConfig.setParallelMaxWorkers(property.getParallelMaxWorkers());
liteflowConfig.setParallelQueueLimit(property.getParallelQueueLimit());
liteflowConfig.setParallelLoopExecutorClass(property.getParallelLoopExecutorClass());
liteflowConfig.setFallbackCmpEnable(property.isFallbackCmpEnable());
liteflowConfig.setFastLoad(property.isFastLoad());
liteflowConfig.setEnableLog(liteflowMonitorProperty.isEnableLog());

View File

@@ -61,13 +61,6 @@
"sourceType": "com.yomahub.liteflow.springboot.LiteflowProperty",
"defaultValue": "com.yomahub.liteflow.thread.LiteFlowDefaultMainExecutorBuilder"
},
{
"name": "liteflow.thread-executor-class",
"type": "java.lang.String",
"description": "Custom thread pool implement for when executor.",
"sourceType": "com.yomahub.liteflow.springboot.LiteflowProperty",
"defaultValue": "com.yomahub.liteflow.thread.LiteFlowDefaultWhenExecutorBuilder"
},
{
"name": "liteflow.when-max-wait-seconds",
"type": "java.lang.Integer",
@@ -89,20 +82,6 @@
"sourceType": "com.yomahub.liteflow.springboot.LiteflowProperty",
"defaultValue": "MILLISECONDS"
},
{
"name": "liteflow.when-max-workers",
"type": "java.lang.Integer",
"description": "Set the async thread pool worker max-size on \" when \" mode.",
"sourceType": "com.yomahub.liteflow.springboot.LiteflowProperty",
"defaultValue": 16
},
{
"name": "liteflow.when-queue-limit",
"type": "java.lang.Integer",
"description": "Set the async thread pool queue max-size on \" when \" mode.",
"sourceType": "com.yomahub.liteflow.springboot.LiteflowProperty",
"defaultValue": 512
},
{
"name": "liteflow.when-thread-pool-isolate",
"type": "java.lang.Boolean",
@@ -194,27 +173,6 @@
"sourceType": "com.yomahub.liteflow.springboot.LiteflowMonitorProperty",
"defaultValue": false
},
{
"name": "liteflow.parallel-max-workers",
"type": "java.lang.Integer",
"description": "Set the async thread pool worker max-size on \" parallel-loop \" mode.",
"sourceType": "com.yomahub.liteflow.springboot.LiteflowProperty",
"defaultValue": 16
},
{
"name": "liteflow.parallel-queue-limit",
"type": "java.lang.Integer",
"description": "Set the async thread pool queue max-size on \" parallel-loop \" mode.",
"sourceType": "com.yomahub.liteflow.springboot.LiteflowProperty",
"defaultValue": 512
},
{
"name": "liteflow.parallel-loop-executor-class",
"type": "java.lang.String",
"description": "Custom thread pool implement for parallel-loop executor.",
"sourceType": "com.yomahub.liteflow.springboot.LiteflowProperty",
"defaultValue": "com.yomahub.liteflow.thread.LiteFlowDefaultParallelLoopExecutorBuilder"
},
{
"name": "liteflow.script-setting",
"type": "java.util.Map",

View File

@@ -4,11 +4,8 @@ liteflow.slot-size=1024
liteflow.main-executor-works=64
liteflow.main-executor-class=com.yomahub.liteflow.thread.LiteFlowDefaultMainExecutorBuilder
liteflow.request-id-generator-class=com.yomahub.liteflow.flow.id.DefaultRequestIdGenerator
liteflow.thread-executor-class=com.yomahub.liteflow.thread.LiteFlowDefaultWhenExecutorBuilder
liteflow.when-max-wait-time=15000
liteflow.when-max-wait-time-unit=MILLISECONDS
liteflow.when-max-workers=16
liteflow.when-queue-limit=512
liteflow.when-thread-pool-isolate=false
liteflow.parse-mode=PARSE_ALL_ON_START
liteflow.retry-count=0
@@ -18,9 +15,6 @@ liteflow.print-execution-log=true
liteflow.fallback-cmp-enable=false
liteflow.fast-load=false
liteflow.check-node-exists=true
liteflow.parallel-max-workers=16
liteflow.parallel-queue-limit=512
liteflow.parallel-loop-executor-class=com.yomahub.liteflow.thread.LiteFlowDefaultParallelLoopExecutorBuilder
liteflow.monitor.enable-log=false
liteflow.monitor.queue-limit=200
liteflow.monitor.delay=300000
@@ -28,5 +22,5 @@ liteflow.monitor.period=300000
liteflow.enable-monitor-file=false
liteflow.global-thread-pool-size=16
liteflow.global-thread-pool-queue-size=512
liteflow.global-thread-pool-executor-class=comcom.yomahub.liteflow.thread.LiteFlowDefaultGlobalExecutorBuilder
liteflow.global-thread-pool-executor-class=com.yomahub.liteflow.thread.LiteFlowDefaultGlobalExecutorBuilder

View File

@@ -1,4 +1,4 @@
liteflow.rule-source=parallelLoop/flow.xml
liteflow.parallel-max-workers = 10
liteflow.parallel-queue-limit = 1024
liteflow.parallel-loop-executor-class =com.yomahub.liteflow.test.parallelLoop.CustomThreadExecutor
liteflow.global-thread-pool-size=16
liteflow.global-thread-pool-queue-size=512
liteflow.global-thread-pool-executor-class=com.yomahub.liteflow.test.parallelLoop.CustomThreadExecutor

View File

@@ -1,4 +1,4 @@
liteflow.rule-source=parallelLoop/flow.xml
liteflow.parallel-max-workers = 10
liteflow.parallel-queue-limit = 1024
liteflow.parallel-loop-executor-class =com.yomahub.liteflow.test.parallelLoop.CustomThreadExecutor
liteflow.global-thread-pool-size=16
liteflow.global-thread-pool-queue-size=512
liteflow.global-thread-pool-executor-class=com.yomahub.liteflow.test.parallelLoop.CustomThreadExecutor

View File

@@ -1,4 +1,4 @@
liteflow.rule-source=parallelLoop/flow.xml
liteflow.parallel-max-workers = 10
liteflow.parallel-queue-limit = 1024
liteflow.parallel-loop-executor-class =com.yomahub.liteflow.test.parallelLoop.CustomThreadExecutor
liteflow.global-thread-pool-size=16
liteflow.global-thread-pool-queue-size=512
liteflow.global-thread-pool-executor-class=com.yomahub.liteflow.test.parallelLoop.CustomThreadExecutor

View File

@@ -1,4 +1,4 @@
liteflow.rule-source=parallelLoop/flow.xml
liteflow.parallel-max-workers = 10
liteflow.parallel-queue-limit = 1024
liteflow.parallel-loop-executor-class =com.yomahub.liteflow.test.parallelLoop.CustomThreadExecutor
liteflow.global-thread-pool-size=16
liteflow.global-thread-pool-queue-size=512
liteflow.global-thread-pool-executor-class=com.yomahub.liteflow.test.parallelLoop.CustomThreadExecutor

View File

@@ -1,4 +1,4 @@
package com.yomahub.liteflow.test.GlobalThreadPool;
package com.yomahub.liteflow.test.chainThreadPool;
import cn.hutool.core.collection.ListUtil;
import com.yomahub.liteflow.core.FlowExecutor;
@@ -39,7 +39,7 @@ public class GlobalThreadPoolELSpringbootTest extends BaseTest {
LiteflowResponse response1 = flowExecutor.execute2Resp("chain1", "arg");
DefaultContext context = response1.getFirstContextBean();
Assertions.assertTrue(response1.isSuccess());
Assertions.assertTrue(context.getData("threadName").toString().startsWith("customer-Global-thead"));
Assertions.assertTrue(context.getData("threadName").toString().startsWith("customer-global-thead"));
}
/**
@@ -50,7 +50,7 @@ public class GlobalThreadPoolELSpringbootTest extends BaseTest {
LiteflowResponse response1 = flowExecutor.execute2Resp("chain2", "arg");
DefaultContext context = response1.getFirstContextBean();
Assertions.assertTrue(response1.isSuccess());
Assertions.assertTrue(context.getData("threadName").toString().startsWith("customer-Global-thead"));
Assertions.assertTrue(context.getData("threadName").toString().startsWith("customer-global-thead"));
}
/**
@@ -61,7 +61,7 @@ public class GlobalThreadPoolELSpringbootTest extends BaseTest {
LiteflowResponse response1 = flowExecutor.execute2Resp("chain3", "arg");
DefaultContext context = response1.getFirstContextBean();
Assertions.assertTrue(response1.isSuccess());
Assertions.assertTrue(context.getData("threadName").toString().startsWith("customer-Global-thead"));
Assertions.assertTrue(context.getData("threadName").toString().startsWith("customer-global-thead"));
}
/**
@@ -73,7 +73,7 @@ public class GlobalThreadPoolELSpringbootTest extends BaseTest {
LiteflowResponse response1 = flowExecutor.execute2Resp("chain4", list);
DefaultContext context = response1.getFirstContextBean();
Assertions.assertTrue(response1.isSuccess());
Assertions.assertTrue(context.getData("threadName").toString().startsWith("customer-Global-thead"));
Assertions.assertTrue(context.getData("threadName").toString().startsWith("customer-global-thead"));
}
}

View File

@@ -16,8 +16,8 @@ public class CustomThreadExecutor1 implements ExecutorBuilder {
if (ObjectUtil.isNull(liteflowConfig)) {
liteflowConfig = new LiteflowConfig();
}
return buildDefaultExecutor(liteflowConfig.getWhenMaxWorkers(), liteflowConfig.getWhenMaxWorkers(),
liteflowConfig.getWhenQueueLimit(), "customer-when-1-thead-");
return buildDefaultExecutor(liteflowConfig.getGlobalThreadPoolSize(), liteflowConfig.getGlobalThreadPoolSize(),
liteflowConfig.getQueueLimit(), "customer-when-1-thead-");
}
}

View File

@@ -16,8 +16,8 @@ public class CustomThreadExecutor2 implements ExecutorBuilder {
if (ObjectUtil.isNull(liteflowConfig)) {
liteflowConfig = new LiteflowConfig();
}
return buildDefaultExecutor(liteflowConfig.getWhenMaxWorkers(), liteflowConfig.getWhenMaxWorkers(),
liteflowConfig.getWhenQueueLimit(), "customer-when-2-thead-");
return buildDefaultExecutor(liteflowConfig.getGlobalThreadPoolSize(), liteflowConfig.getGlobalThreadPoolSize(),
liteflowConfig.getQueueLimit(), "customer-when-2-thead-");
}
}

View File

@@ -16,8 +16,8 @@ public class CustomThreadExecutor3 implements ExecutorBuilder {
if (ObjectUtil.isNull(liteflowConfig)) {
liteflowConfig = new LiteflowConfig();
}
return buildDefaultExecutor(liteflowConfig.getWhenMaxWorkers(), liteflowConfig.getWhenMaxWorkers(),
liteflowConfig.getWhenQueueLimit(), "customer-when-3-thead-");
return buildDefaultExecutor(liteflowConfig.getGlobalThreadPoolSize(), liteflowConfig.getGlobalThreadPoolSize(),
liteflowConfig.getQueueLimit(), "customer-when-3-thead-");
}
}

View File

@@ -40,7 +40,7 @@ public class CustomWhenThreadPoolELSpringbootTest extends BaseTest {
LiteflowResponse response = flowExecutor.execute2Resp("chain", "arg");
DefaultContext context = response.getFirstContextBean();
Assertions.assertTrue(response.isSuccess());
Assertions.assertTrue(context.getData("threadName").toString().startsWith("when-thread-1"));
Assertions.assertTrue(context.getData("threadName").toString().startsWith("global-thread-1"));
}
/**

View File

@@ -16,8 +16,8 @@ public class CustomThreadExecutor implements ExecutorBuilder {
if (ObjectUtil.isNull(liteflowConfig)) {
liteflowConfig = new LiteflowConfig();
}
return buildDefaultExecutor(liteflowConfig.getParallelMaxWorkers(), liteflowConfig.getParallelMaxWorkers(),
liteflowConfig.getParallelQueueLimit(), "customer-loop-thead-");
return buildDefaultExecutor(liteflowConfig.getGlobalThreadPoolSize(), liteflowConfig.getGlobalThreadPoolSize(),
liteflowConfig.getQueueLimit(), "customer-loop-thead-");
}
}

View File

@@ -7,9 +7,7 @@
<chain name="chain2"
thread-pool-executor-class="com.yomahub.liteflow.test.chainThreadPool.CustomChainThreadExecutor">
FOR(5).parallel(true).DO(THEN(a,f
)
);
FOR(5).parallel(true).DO(THEN(a,f));
</chain>
<chain name="chain3"

View File

@@ -5,8 +5,7 @@
</chain>
<chain name="chain2">
FOR(5).parallel(true).DO(THEN(a,f
)
FOR(5).parallel(true).DO(THEN(a,f)
);
</chain>

View File

@@ -1,4 +1,4 @@
liteflow.rule-source=parallelLoop/flow.xml
liteflow.parallel-max-workers = 10
liteflow.parallel-queue-limit = 1024
liteflow.parallel-loop-executor-class =com.yomahub.liteflow.test.parallelLoop.CustomThreadExecutor
liteflow.global-thread-pool-size=16
liteflow.global-thread-pool-queue-size=512
liteflow.global-thread-pool-executor-class=com.yomahub.liteflow.test.parallelLoop.CustomThreadExecutor