1
0
jason 6 сар өмнө
parent
commit
6c45e80c90
100 өөрчлөгдсөн 2458 нэмэгдсэн , 48 устгасан
  1. 1 0
      liteflow-solon-plugin/src/main/java/com/yomahub/liteflow/solon/config/LiteflowAutoConfiguration.java
  2. 15 0
      liteflow-solon-plugin/src/main/java/com/yomahub/liteflow/solon/config/LiteflowProperty.java
  3. 2 2
      liteflow-testcase-el/liteflow-testcase-el-builder/src/test/java/com/yomahub/liteflow/test/builder/customTreadExecutor/CustomThreadExecutor1.java
  4. 72 0
      liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/java/com/yomahub/liteflow/test/chainThreadPool/ChainThreadPoolELSpringbootTest.java
  5. 73 0
      liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/java/com/yomahub/liteflow/test/chainThreadPool/ConditionThreadPoolELSpringbootTest.java
  6. 23 0
      liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/java/com/yomahub/liteflow/test/chainThreadPool/CustomChainThreadExecutor.java
  7. 23 0
      liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/java/com/yomahub/liteflow/test/chainThreadPool/CustomGlobalThreadExecutor.java
  8. 23 0
      liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/java/com/yomahub/liteflow/test/chainThreadPool/CustomLoopThreadExecutor.java
  9. 23 0
      liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/java/com/yomahub/liteflow/test/chainThreadPool/CustomWhenThreadExecutor.java
  10. 71 0
      liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/java/com/yomahub/liteflow/test/chainThreadPool/GlobalThreadPoolELSpringbootTest.java
  11. 81 0
      liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/java/com/yomahub/liteflow/test/chainThreadPool/cmp/CmpConfig.java
  12. 2 2
      liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/java/com/yomahub/liteflow/test/customWhenThreadPool/CustomThreadExecutor1.java
  13. 2 2
      liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/java/com/yomahub/liteflow/test/customWhenThreadPool/CustomThreadExecutor2.java
  14. 2 2
      liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/java/com/yomahub/liteflow/test/customWhenThreadPool/CustomThreadExecutor3.java
  15. 1 1
      liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/java/com/yomahub/liteflow/test/customWhenThreadPool/CustomWhenThreadPoolELDeclMultiSpringbootTest.java
  16. 2 2
      liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/java/com/yomahub/liteflow/test/parallelLoop/CustomThreadExecutor.java
  17. 1 0
      liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/resources/chainThreadPool/application.properties
  18. 2 0
      liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/resources/chainThreadPool/application2.properties
  19. 4 0
      liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/resources/chainThreadPool/application3.properties
  20. 22 0
      liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/resources/chainThreadPool/flow.el.xml
  21. 22 0
      liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/resources/chainThreadPool/flow2.el.xml
  22. 19 0
      liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/resources/chainThreadPool/flow3.el.xml
  23. 79 0
      liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/java/com/yomahub/liteflow/test/chainThreadPool/ChainThreadPoolELSpringbootTest.java
  24. 79 0
      liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/java/com/yomahub/liteflow/test/chainThreadPool/ConditionThreadPoolELSpringbootTest.java
  25. 23 0
      liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/java/com/yomahub/liteflow/test/chainThreadPool/CustomChainThreadExecutor.java
  26. 23 0
      liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/java/com/yomahub/liteflow/test/chainThreadPool/CustomGlobalThreadExecutor.java
  27. 23 0
      liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/java/com/yomahub/liteflow/test/chainThreadPool/CustomLoopThreadExecutor.java
  28. 23 0
      liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/java/com/yomahub/liteflow/test/chainThreadPool/CustomWhenThreadExecutor.java
  29. 79 0
      liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/java/com/yomahub/liteflow/test/chainThreadPool/GlobalThreadPoolELSpringbootTest.java
  30. 81 0
      liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/java/com/yomahub/liteflow/test/chainThreadPool/cmp/CmpConfig.java
  31. 2 2
      liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/java/com/yomahub/liteflow/test/customWhenThreadPool/CustomThreadExecutor1.java
  32. 2 2
      liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/java/com/yomahub/liteflow/test/customWhenThreadPool/CustomThreadExecutor2.java
  33. 2 2
      liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/java/com/yomahub/liteflow/test/customWhenThreadPool/CustomThreadExecutor3.java
  34. 2 3
      liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/java/com/yomahub/liteflow/test/customWhenThreadPool/CustomWhenThreadPoolELDeclMultiSpringbootTest.java
  35. 2 2
      liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/java/com/yomahub/liteflow/test/parallelLoop/CustomThreadExecutor.java
  36. 1 0
      liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/chainThreadPool/application.properties
  37. 2 0
      liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/chainThreadPool/application2.properties
  38. 4 0
      liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/chainThreadPool/application3.properties
  39. 22 0
      liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/chainThreadPool/flow.el.xml
  40. 22 0
      liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/chainThreadPool/flow2.el.xml
  41. 19 0
      liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/chainThreadPool/flow3.el.xml
  42. 79 0
      liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/chainThreadPool/ChainThreadPoolELSpringbootTest.java
  43. 79 0
      liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/chainThreadPool/ConditionThreadPoolELSpringbootTest.java
  44. 23 0
      liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/chainThreadPool/CustomChainThreadExecutor.java
  45. 23 0
      liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/chainThreadPool/CustomGlobalThreadExecutor.java
  46. 23 0
      liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/chainThreadPool/CustomLoopThreadExecutor.java
  47. 23 0
      liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/chainThreadPool/CustomWhenThreadExecutor.java
  48. 79 0
      liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/chainThreadPool/GlobalThreadPoolELSpringbootTest.java
  49. 24 0
      liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/chainThreadPool/cmp/ACmp.java
  50. 27 0
      liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/chainThreadPool/cmp/BCmp.java
  51. 81 0
      liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/chainThreadPool/cmp/CmpConfig.java
  52. 32 0
      liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/chainThreadPool/cmp/DCmp.java
  53. 19 0
      liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/chainThreadPool/cmp/FCmp.java
  54. 27 0
      liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/chainThreadPool/cmp/ICmp.java
  55. 23 0
      liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/chainThreadPool/cmp/ITCmp.java
  56. 27 0
      liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/chainThreadPool/cmp/WCmp.java
  57. 25 0
      liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/chainThreadPool/cmp/ZCmp.java
  58. 2 2
      liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/customWhenThreadPool/CustomThreadExecutor1.java
  59. 2 2
      liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/customWhenThreadPool/CustomThreadExecutor2.java
  60. 2 2
      liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/customWhenThreadPool/CustomThreadExecutor3.java
  61. 2 3
      liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/customWhenThreadPool/CustomWhenThreadPoolELDeclSpringbootTest.java
  62. 2 2
      liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/parallelLoop/CustomThreadExecutor.java
  63. 1 0
      liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/resources/chainThreadPool/application.properties
  64. 2 0
      liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/resources/chainThreadPool/application2.properties
  65. 4 0
      liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/resources/chainThreadPool/application3.properties
  66. 22 0
      liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/resources/chainThreadPool/flow.el.xml
  67. 22 0
      liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/resources/chainThreadPool/flow2.el.xml
  68. 19 0
      liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/resources/chainThreadPool/flow3.el.xml
  69. 76 0
      liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/chainThreadPool/ChainThreadPoolELSpringbootTest.java
  70. 76 0
      liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/chainThreadPool/ConditionThreadPoolELSpringbootTest.java
  71. 23 0
      liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/chainThreadPool/CustomChainThreadExecutor.java
  72. 23 0
      liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/chainThreadPool/CustomGlobalThreadExecutor.java
  73. 23 0
      liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/chainThreadPool/CustomLoopThreadExecutor.java
  74. 23 0
      liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/chainThreadPool/CustomWhenThreadExecutor.java
  75. 80 0
      liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/chainThreadPool/GlobalThreadPoolELSpringbootTest.java
  76. 21 0
      liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/chainThreadPool/cmp/ACmp.java
  77. 23 0
      liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/chainThreadPool/cmp/BCmp.java
  78. 28 0
      liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/chainThreadPool/cmp/DCmp.java
  79. 24 0
      liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/chainThreadPool/cmp/FCmp.java
  80. 23 0
      liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/chainThreadPool/cmp/ICmp.java
  81. 15 0
      liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/chainThreadPool/cmp/ITCmp.java
  82. 23 0
      liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/chainThreadPool/cmp/WCmp.java
  83. 20 0
      liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/chainThreadPool/cmp/ZCmp.java
  84. 2 2
      liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/config/LiteflowConfigTest1.java
  85. 2 2
      liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/customWhenThreadPool/CustomThreadExecutor1.java
  86. 2 2
      liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/customWhenThreadPool/CustomThreadExecutor2.java
  87. 2 2
      liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/customWhenThreadPool/CustomThreadExecutor3.java
  88. 1 1
      liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/customWhenThreadPool/CustomWhenThreadPoolTest.java
  89. 2 2
      liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/parallelLoop/CustomThreadExecutor.java
  90. 3 4
      liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/parallelLoop/ParallelLoopTest.java
  91. 1 0
      liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/resources/chainThreadPool/application.properties
  92. 2 0
      liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/resources/chainThreadPool/application2.properties
  93. 4 0
      liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/resources/chainThreadPool/application3.properties
  94. 33 0
      liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/resources/chainThreadPool/flow.el.xml
  95. 32 0
      liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/resources/chainThreadPool/flow2.el.xml
  96. 29 0
      liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/resources/chainThreadPool/flow3.el.xml
  97. 4 0
      liteflow-testcase-el/liteflow-testcase-el-solon/pom.xml
  98. 72 0
      liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/chainThreadPool/ChainThreadPoolELSpringbootTest.java
  99. 73 0
      liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/chainThreadPool/ConditionThreadPoolELSpringbootTest.java
  100. 23 0
      liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/chainThreadPool/CustomChainThreadExecutor.java

+ 1 - 0
liteflow-solon-plugin/src/main/java/com/yomahub/liteflow/solon/config/LiteflowAutoConfiguration.java

@@ -48,6 +48,7 @@ public class LiteflowAutoConfiguration {
         liteflowConfig.setGlobalThreadPoolExecutorClass(property.getGlobalThreadPoolExecutorClass());
         liteflowConfig.setGlobalThreadPoolExecutorClass(property.getGlobalThreadPoolExecutorClass());
         liteflowConfig.setGlobalThreadPoolSize(property.getGlobalThreadPoolSize());
         liteflowConfig.setGlobalThreadPoolSize(property.getGlobalThreadPoolSize());
         liteflowConfig.setGlobalThreadPoolQueueSize(property.getGlobalThreadPoolQueueSize());
         liteflowConfig.setGlobalThreadPoolQueueSize(property.getGlobalThreadPoolQueueSize());
+        liteflowConfig.setWhenThreadPoolIsolate(property.getWhenThreadPoolIsolate());
 		return liteflowConfig;
 		return liteflowConfig;
 	}
 	}
 
 

+ 15 - 0
liteflow-solon-plugin/src/main/java/com/yomahub/liteflow/solon/config/LiteflowProperty.java

@@ -94,6 +94,9 @@ public class LiteflowProperty {
     //全局线程池最大队列数
     //全局线程池最大队列数
     private Integer globalThreadPoolQueueSize;
     private Integer globalThreadPoolQueueSize;
 
 
+    // 异步线程池是否隔离
+    private Boolean whenThreadPoolIsolate;
+
 	public boolean isEnable() {
 	public boolean isEnable() {
 		return enable;
 		return enable;
 	}
 	}
@@ -314,4 +317,16 @@ public class LiteflowProperty {
     public void setGlobalThreadPoolExecutorClass(String globalThreadPoolExecutorClass) {
     public void setGlobalThreadPoolExecutorClass(String globalThreadPoolExecutorClass) {
         this.globalThreadPoolExecutorClass = globalThreadPoolExecutorClass;
         this.globalThreadPoolExecutorClass = globalThreadPoolExecutorClass;
     }
     }
+
+    public Boolean getWhenThreadPoolIsolate() {
+        if (ObjectUtil.isNull(whenThreadPoolIsolate)) {
+            return Boolean.FALSE;
+        } else {
+            return whenThreadPoolIsolate;
+        }
+    }
+
+    public void setWhenThreadPoolIsolate(Boolean whenThreadPoolIsolate) {
+        this.whenThreadPoolIsolate = whenThreadPoolIsolate;
+    }
 }
 }

+ 2 - 2
liteflow-testcase-el/liteflow-testcase-el-builder/src/test/java/com/yomahub/liteflow/test/builder/customTreadExecutor/CustomThreadExecutor1.java

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

+ 72 - 0
liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/java/com/yomahub/liteflow/test/chainThreadPool/ChainThreadPoolELSpringbootTest.java

@@ -0,0 +1,72 @@
+package com.yomahub.liteflow.test.chainThreadPool;
+
+import cn.hutool.core.collection.ListUtil;
+import com.yomahub.liteflow.core.FlowExecutor;
+import com.yomahub.liteflow.flow.LiteflowResponse;
+import com.yomahub.liteflow.slot.DefaultContext;
+import com.yomahub.liteflow.test.BaseTest;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+import org.noear.solon.annotation.Import;
+import org.noear.solon.annotation.Inject;
+import org.noear.solon.test.SolonTest;
+
+import java.util.List;
+
+/**
+ * springboot环境下chain线程池隔离测试
+ */
+@SolonTest
+@Import(profiles = "classpath:/chainThreadPool/application.properties")
+public class ChainThreadPoolELSpringbootTest extends BaseTest {
+
+
+    @Inject
+    private FlowExecutor flowExecutor;
+
+    /**
+     * 测试WHEN上全局线程池和chain线程池隔离-优先以chain上为准
+     */
+    @Test
+    public void testChainThreadPool() {
+        LiteflowResponse response1 = flowExecutor.execute2Resp("chain1", "arg");
+        DefaultContext context = response1.getFirstContextBean();
+        Assertions.assertTrue(response1.isSuccess());
+        Assertions.assertTrue(context.getData("threadName").toString().startsWith("customer-chain-thead"));
+    }
+
+    /**
+     * 测试FOR上全局线程池和chain线程池隔离-优先以chain上为准
+     */
+    @Test
+    public void testChainThreadPool2() {
+        LiteflowResponse response1 = flowExecutor.execute2Resp("chain2", "arg");
+        DefaultContext context = response1.getFirstContextBean();
+        Assertions.assertTrue(response1.isSuccess());
+        Assertions.assertTrue(context.getData("threadName").toString().startsWith("customer-chain-thead"));
+    }
+
+    /**
+     * 测试WHILE上全局线程池和chain线程池隔离-优先以chain上为准
+     */
+    @Test
+    public void testChainThreadPool3() {
+        LiteflowResponse response1 = flowExecutor.execute2Resp("chain3", "arg");
+        DefaultContext context = response1.getFirstContextBean();
+        Assertions.assertTrue(response1.isSuccess());
+        Assertions.assertTrue(context.getData("threadName").toString().startsWith("customer-chain-thead"));
+    }
+
+    /**
+     * 测试ITERATOR上全局线程池和chain线程池隔离-优先以chain上为准
+     */
+    @Test
+    public void testChainThreadPool4() {
+        List<String> list = ListUtil.toList("1", "2", "3", "4", "5");
+        LiteflowResponse response1 = flowExecutor.execute2Resp("chain4", list);
+        DefaultContext context = response1.getFirstContextBean();
+        Assertions.assertTrue(response1.isSuccess());
+        Assertions.assertTrue(context.getData("threadName").toString().startsWith("customer-chain-thead"));
+    }
+
+}

+ 73 - 0
liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/java/com/yomahub/liteflow/test/chainThreadPool/ConditionThreadPoolELSpringbootTest.java

@@ -0,0 +1,73 @@
+package com.yomahub.liteflow.test.chainThreadPool;
+
+import cn.hutool.core.collection.ListUtil;
+import com.yomahub.liteflow.core.FlowExecutor;
+import com.yomahub.liteflow.flow.LiteflowResponse;
+import com.yomahub.liteflow.slot.DefaultContext;
+import com.yomahub.liteflow.test.BaseTest;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+import org.noear.solon.annotation.Import;
+import org.noear.solon.annotation.Inject;
+import org.noear.solon.test.SolonTest;
+
+import java.util.List;
+
+/**
+ * springboot环境下chain线程池隔离测试
+ */
+
+@SolonTest
+@Import(profiles = "classpath:/chainThreadPool/application2.properties")
+public class ConditionThreadPoolELSpringbootTest extends BaseTest {
+
+
+    @Inject
+    private FlowExecutor flowExecutor;
+
+    /**
+     * 测试WEHN上condition线程池和chain线程池隔离-优先以WHEN上为准
+     */
+    @Test
+    public void testConditionThreadPool() {
+        LiteflowResponse response1 = flowExecutor.execute2Resp("chain1", "arg");
+        DefaultContext context = response1.getFirstContextBean();
+        Assertions.assertTrue(response1.isSuccess());
+        Assertions.assertTrue(context.getData("threadName").toString().startsWith("customer-when-thead"));
+    }
+
+    /**
+     * 测试FOR上condition线程池和chain线程池隔离-优先以FOR上为准
+     */
+    @Test
+    public void testConditionThreadPool2() {
+        LiteflowResponse response1 = flowExecutor.execute2Resp("chain2", "arg");
+        DefaultContext context = response1.getFirstContextBean();
+        Assertions.assertTrue(response1.isSuccess());
+        Assertions.assertTrue(context.getData("threadName").toString().startsWith("customer-loop-thead"));
+    }
+
+    /**
+     * 测试WHILE上condition线程池和chain线程池隔离-优先以WHILE上为准
+     */
+    @Test
+    public void testConditionThreadPool3() {
+        LiteflowResponse response1 = flowExecutor.execute2Resp("chain3", "arg");
+        DefaultContext context = response1.getFirstContextBean();
+        Assertions.assertTrue(response1.isSuccess());
+        Assertions.assertTrue(context.getData("threadName").toString().startsWith("customer-loop-thead"));
+    }
+
+    /**
+     * 测试ITERATOR上condition线程池和chain线程池隔离-优先以ITERATOR上为准
+     */
+    @Test
+    public void testConditionThreadPool4() {
+        List<String> list = ListUtil.toList("1", "2", "3", "4", "5");
+        LiteflowResponse response1 = flowExecutor.execute2Resp("chain4", list);
+        DefaultContext context = response1.getFirstContextBean();
+        Assertions.assertTrue(response1.isSuccess());
+        Assertions.assertTrue(context.getData("threadName").toString().startsWith("customer-loop-thead"));
+    }
+
+}

+ 23 - 0
liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/java/com/yomahub/liteflow/test/chainThreadPool/CustomChainThreadExecutor.java

@@ -0,0 +1,23 @@
+package com.yomahub.liteflow.test.chainThreadPool;
+
+import cn.hutool.core.util.ObjectUtil;
+import com.yomahub.liteflow.property.LiteflowConfig;
+import com.yomahub.liteflow.property.LiteflowConfigGetter;
+import com.yomahub.liteflow.thread.ExecutorBuilder;
+
+import java.util.concurrent.ExecutorService;
+
+public class CustomChainThreadExecutor implements ExecutorBuilder {
+
+    @Override
+    public ExecutorService buildExecutor() {
+        LiteflowConfig liteflowConfig = LiteflowConfigGetter.get();
+        // 只有在非spring的场景下liteflowConfig才会为null
+        if (ObjectUtil.isNull(liteflowConfig)) {
+            liteflowConfig = new LiteflowConfig();
+        }
+        return buildDefaultExecutor(16, 16,
+                                    512, "customer-chain-thead");
+    }
+
+}

+ 23 - 0
liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/java/com/yomahub/liteflow/test/chainThreadPool/CustomGlobalThreadExecutor.java

@@ -0,0 +1,23 @@
+package com.yomahub.liteflow.test.chainThreadPool;
+
+import cn.hutool.core.util.ObjectUtil;
+import com.yomahub.liteflow.property.LiteflowConfig;
+import com.yomahub.liteflow.property.LiteflowConfigGetter;
+import com.yomahub.liteflow.thread.ExecutorBuilder;
+
+import java.util.concurrent.ExecutorService;
+
+public class CustomGlobalThreadExecutor implements ExecutorBuilder {
+
+    @Override
+    public ExecutorService buildExecutor() {
+        LiteflowConfig liteflowConfig = LiteflowConfigGetter.get();
+        // 只有在非spring的场景下liteflowConfig才会为null
+        if (ObjectUtil.isNull(liteflowConfig)) {
+            liteflowConfig = new LiteflowConfig();
+        }
+        return buildDefaultExecutor(16, 16,
+                                    512, "customer-global-thead");
+    }
+
+}

+ 23 - 0
liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/java/com/yomahub/liteflow/test/chainThreadPool/CustomLoopThreadExecutor.java

@@ -0,0 +1,23 @@
+package com.yomahub.liteflow.test.chainThreadPool;
+
+import cn.hutool.core.util.ObjectUtil;
+import com.yomahub.liteflow.property.LiteflowConfig;
+import com.yomahub.liteflow.property.LiteflowConfigGetter;
+import com.yomahub.liteflow.thread.ExecutorBuilder;
+
+import java.util.concurrent.ExecutorService;
+
+public class CustomLoopThreadExecutor implements ExecutorBuilder {
+
+    @Override
+    public ExecutorService buildExecutor() {
+        LiteflowConfig liteflowConfig = LiteflowConfigGetter.get();
+        // 只有在非spring的场景下liteflowConfig才会为null
+        if (ObjectUtil.isNull(liteflowConfig)) {
+            liteflowConfig = new LiteflowConfig();
+        }
+        return buildDefaultExecutor(16, 16,
+                                    512, "customer-loop-thead");
+    }
+
+}

+ 23 - 0
liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/java/com/yomahub/liteflow/test/chainThreadPool/CustomWhenThreadExecutor.java

@@ -0,0 +1,23 @@
+package com.yomahub.liteflow.test.chainThreadPool;
+
+import cn.hutool.core.util.ObjectUtil;
+import com.yomahub.liteflow.property.LiteflowConfig;
+import com.yomahub.liteflow.property.LiteflowConfigGetter;
+import com.yomahub.liteflow.thread.ExecutorBuilder;
+
+import java.util.concurrent.ExecutorService;
+
+public class CustomWhenThreadExecutor implements ExecutorBuilder {
+
+    @Override
+    public ExecutorService buildExecutor() {
+        LiteflowConfig liteflowConfig = LiteflowConfigGetter.get();
+        // 只有在非spring的场景下liteflowConfig才会为null
+        if (ObjectUtil.isNull(liteflowConfig)) {
+            liteflowConfig = new LiteflowConfig();
+        }
+        return buildDefaultExecutor(16, 16,
+                                    512, "customer-when-thead");
+    }
+
+}

+ 71 - 0
liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/java/com/yomahub/liteflow/test/chainThreadPool/GlobalThreadPoolELSpringbootTest.java

@@ -0,0 +1,71 @@
+package com.yomahub.liteflow.test.chainThreadPool;
+
+import cn.hutool.core.collection.ListUtil;
+import com.yomahub.liteflow.core.FlowExecutor;
+import com.yomahub.liteflow.flow.LiteflowResponse;
+import com.yomahub.liteflow.slot.DefaultContext;
+import com.yomahub.liteflow.test.BaseTest;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+import org.noear.solon.annotation.Import;
+import org.noear.solon.annotation.Inject;
+import org.noear.solon.test.SolonTest;
+
+import java.util.List;
+
+/**
+ * springboot环境下Global线程池隔离测试
+ */
+@SolonTest
+@Import(profiles = "classpath:/chainThreadPool/application3.properties")
+public class GlobalThreadPoolELSpringbootTest extends BaseTest {
+
+    @Inject
+    private FlowExecutor flowExecutor;
+
+    /**
+     * 测试WHEN上全局线程池
+     */
+    @Test
+    public void testGlobalThreadPool() {
+        LiteflowResponse response1 = flowExecutor.execute2Resp("chain1", "arg");
+        DefaultContext context = response1.getFirstContextBean();
+        Assertions.assertTrue(response1.isSuccess());
+        Assertions.assertTrue(context.getData("threadName").toString().startsWith("customer-global-thead"));
+    }
+
+    /**
+     * 测试FOR上全局线程池
+     */
+    @Test
+    public void testGlobalThreadPool2() {
+        LiteflowResponse response1 = flowExecutor.execute2Resp("chain2", "arg");
+        DefaultContext context = response1.getFirstContextBean();
+        Assertions.assertTrue(response1.isSuccess());
+        Assertions.assertTrue(context.getData("threadName").toString().startsWith("customer-global-thead"));
+    }
+
+    /**
+     * 测试WHILE上全局线程池
+     */
+    @Test
+    public void testGlobalThreadPool3() {
+        LiteflowResponse response1 = flowExecutor.execute2Resp("chain3", "arg");
+        DefaultContext context = response1.getFirstContextBean();
+        Assertions.assertTrue(response1.isSuccess());
+        Assertions.assertTrue(context.getData("threadName").toString().startsWith("customer-global-thead"));
+    }
+
+    /**
+     * 测试ITERATOR上全局线程池
+     */
+    @Test
+    public void testGlobalThreadPool4() {
+        List<String> list = ListUtil.toList("1", "2", "3", "4", "5");
+        LiteflowResponse response1 = flowExecutor.execute2Resp("chain4", list);
+        DefaultContext context = response1.getFirstContextBean();
+        Assertions.assertTrue(response1.isSuccess());
+        Assertions.assertTrue(context.getData("threadName").toString().startsWith("customer-global-thead"));
+    }
+
+}

+ 81 - 0
liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/java/com/yomahub/liteflow/test/chainThreadPool/cmp/CmpConfig.java

@@ -0,0 +1,81 @@
+package com.yomahub.liteflow.test.chainThreadPool.cmp;
+
+import com.yomahub.liteflow.annotation.LiteflowComponent;
+import com.yomahub.liteflow.annotation.LiteflowMethod;
+import com.yomahub.liteflow.core.NodeComponent;
+import com.yomahub.liteflow.enums.LiteFlowMethodEnum;
+import com.yomahub.liteflow.enums.NodeTypeEnum;
+import com.yomahub.liteflow.slot.DefaultContext;
+
+import java.util.Iterator;
+import java.util.List;
+
+@LiteflowComponent
+public class CmpConfig {
+
+	@LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "a")
+	public void processA(NodeComponent bindCmp) {
+
+		System.out.println("ACmp executed!");
+	}
+
+	@LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "b")
+	public void processB(NodeComponent bindCmp) {
+		DefaultContext context = bindCmp.getFirstContextBean();
+		context.setData("threadName", Thread.currentThread().getName());
+		System.out.println("BCmp executed!");
+	}
+
+
+	@LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "d")
+	public void processD(NodeComponent bindCmp) {
+		DefaultContext context = bindCmp.getFirstContextBean();
+		String key = "test";
+		if (context.hasData(key)) {
+			int count = context.getData(key);
+			context.setData(key, ++count);
+		} else {
+			context.setData(key, 1);
+		}
+	}
+
+	@LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "f")
+	public void processE(NodeComponent bindCmp) {
+		DefaultContext context = bindCmp.getFirstContextBean();
+		context.setData("threadName", Thread.currentThread().getName());
+		System.out.println("FCmp executed!");
+	}
+
+	@LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "i")
+	public void processI(NodeComponent bindCmp) {
+		DefaultContext context = bindCmp.getFirstContextBean();
+		context.setData("threadName", Thread.currentThread().getName());
+		System.out.println("ICmp executed!");
+	}
+
+	@LiteflowMethod(value = LiteFlowMethodEnum.PROCESS_ITERATOR, nodeId = "it", nodeType = NodeTypeEnum.ITERATOR)
+	public Iterator<String> processIT(NodeComponent bindCmp) {
+		List<String> list = bindCmp.getRequestData();
+		return list.iterator();
+	}
+
+	@LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "w")
+	public void processW(NodeComponent bindCmp) {
+		DefaultContext context = bindCmp.getFirstContextBean();
+		context.setData("threadName", Thread.currentThread().getName());
+		System.out.println("WCmp executed!");
+	}
+
+	@LiteflowMethod(value = LiteFlowMethodEnum.PROCESS_BOOLEAN, nodeId = "z", nodeType = NodeTypeEnum.BOOLEAN)
+	public boolean processZ(NodeComponent bindCmp) {
+		DefaultContext context = bindCmp.getFirstContextBean();
+		String key = "test";
+		if (context.hasData(key)) {
+			int count = context.getData("test");
+			return count < 5;
+		} else {
+			return true;
+		}
+	}
+
+}

+ 2 - 2
liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/java/com/yomahub/liteflow/test/customWhenThreadPool/CustomThreadExecutor1.java

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

+ 2 - 2
liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/java/com/yomahub/liteflow/test/customWhenThreadPool/CustomThreadExecutor2.java

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

+ 2 - 2
liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/java/com/yomahub/liteflow/test/customWhenThreadPool/CustomThreadExecutor3.java

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

+ 1 - 1
liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/java/com/yomahub/liteflow/test/customWhenThreadPool/CustomWhenThreadPoolELDeclMultiSpringbootTest.java

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

+ 2 - 2
liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/java/com/yomahub/liteflow/test/parallelLoop/CustomThreadExecutor.java

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

+ 1 - 0
liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/resources/chainThreadPool/application.properties

@@ -0,0 +1 @@
+liteflow.rule-source=chainThreadPool/flow.el.xml

+ 2 - 0
liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/resources/chainThreadPool/application2.properties

@@ -0,0 +1,2 @@
+liteflow.rule-source=chainThreadPool/flow2.el.xml
+liteflow.when-thread-pool-isolate=true

+ 4 - 0
liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/resources/chainThreadPool/application3.properties

@@ -0,0 +1,4 @@
+liteflow.rule-source=chainThreadPool/flow3.el.xml
+liteflow.global-thread-pool-size=16
+liteflow.global-thread-pool-queue-size=512
+liteflow.global-thread-pool-executor-class=com.yomahub.liteflow.test.chainThreadPool.CustomGlobalThreadExecutor

+ 22 - 0
liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/resources/chainThreadPool/flow.el.xml

@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<flow>
+    <chain name="chain1"
+           thread-pool-executor-class="com.yomahub.liteflow.test.chainThreadPool.CustomChainThreadExecutor">
+        WHEN(a,b);
+    </chain>
+
+    <chain name="chain2"
+           thread-pool-executor-class="com.yomahub.liteflow.test.chainThreadPool.CustomChainThreadExecutor">
+        FOR(5).parallel(true).DO(THEN(a,f));
+    </chain>
+
+    <chain name="chain3"
+           thread-pool-executor-class="com.yomahub.liteflow.test.chainThreadPool.CustomChainThreadExecutor">
+        WHILE(z).parallel(true).DO(THEN(w,d));
+    </chain>
+
+    <chain name="chain4"
+           thread-pool-executor-class="com.yomahub.liteflow.test.chainThreadPool.CustomChainThreadExecutor">
+        ITERATOR(it).parallel(true).DO(THEN(a,i));
+    </chain>
+</flow>

+ 22 - 0
liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/resources/chainThreadPool/flow2.el.xml

@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<flow>
+    <chain name="chain1"
+           thread-pool-executor-class="com.yomahub.liteflow.test.chainThreadPool.CustomChainThreadExecutor">
+        WHEN(a,b).threadPool("com.yomahub.liteflow.test.chainThreadPool.CustomWhenThreadExecutor");
+    </chain>
+
+    <chain name="chain2"
+           thread-pool-executor-class="com.yomahub.liteflow.test.chainThreadPool.CustomChainThreadExecutor">
+        FOR(5).parallel(true).DO(THEN(a,f)).threadPool("com.yomahub.liteflow.test.chainThreadPool.CustomLoopThreadExecutor");
+    </chain>
+
+    <chain name="chain3"
+           thread-pool-executor-class="com.yomahub.liteflow.test.chainThreadPool.CustomChainThreadExecutor">
+        WHILE(z).parallel(true).DO(THEN(w,d)).threadPool("com.yomahub.liteflow.test.chainThreadPool.CustomLoopThreadExecutor");
+    </chain>
+
+    <chain name="chain4"
+           thread-pool-executor-class="com.yomahub.liteflow.test.chainThreadPool.CustomChainThreadExecutor">
+        ITERATOR(it).parallel(true).DO(THEN(a,i)).threadPool("com.yomahub.liteflow.test.chainThreadPool.CustomLoopThreadExecutor");
+    </chain>
+</flow>

+ 19 - 0
liteflow-testcase-el/liteflow-testcase-el-declare-multi-solon/src/test/resources/chainThreadPool/flow3.el.xml

@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<flow>
+    <chain name="chain1">
+        WHEN(a,b);
+    </chain>
+
+    <chain name="chain2">
+        FOR(5).parallel(true).DO(THEN(a,f)
+        );
+    </chain>
+
+    <chain name="chain3">
+        WHILE(z).parallel(true).DO(THEN(w,d));
+    </chain>
+
+    <chain name="chain4">
+        ITERATOR(it).parallel(true).DO(THEN(a,i));
+    </chain>
+</flow>

+ 79 - 0
liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/java/com/yomahub/liteflow/test/chainThreadPool/ChainThreadPoolELSpringbootTest.java

@@ -0,0 +1,79 @@
+package com.yomahub.liteflow.test.chainThreadPool;
+
+import cn.hutool.core.collection.ListUtil;
+import com.yomahub.liteflow.core.FlowExecutor;
+import com.yomahub.liteflow.flow.LiteflowResponse;
+import com.yomahub.liteflow.slot.DefaultContext;
+import com.yomahub.liteflow.test.BaseTest;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.test.context.TestPropertySource;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * springboot环境下chain线程池隔离测试
+ */
+@TestPropertySource(value = "classpath:/chainThreadPool/application.properties")
+@SpringBootTest(classes = ChainThreadPoolELSpringbootTest.class)
+@EnableAutoConfiguration
+@ComponentScan({"com.yomahub.liteflow.test.chainThreadPool.cmp"})
+public class ChainThreadPoolELSpringbootTest extends BaseTest {
+
+    private final Logger log = LoggerFactory.getLogger(this.getClass());
+
+    @Resource
+    private FlowExecutor flowExecutor;
+
+    /**
+     * 测试WHEN上全局线程池和chain线程池隔离-优先以chain上为准
+     */
+    @Test
+    public void testChainThreadPool() {
+        LiteflowResponse response1 = flowExecutor.execute2Resp("chain1", "arg");
+        DefaultContext context = response1.getFirstContextBean();
+        Assertions.assertTrue(response1.isSuccess());
+        Assertions.assertTrue(context.getData("threadName").toString().startsWith("customer-chain-thead"));
+    }
+
+    /**
+     * 测试FOR上全局线程池和chain线程池隔离-优先以chain上为准
+     */
+    @Test
+    public void testChainThreadPool2() {
+        LiteflowResponse response1 = flowExecutor.execute2Resp("chain2", "arg");
+        DefaultContext context = response1.getFirstContextBean();
+        Assertions.assertTrue(response1.isSuccess());
+        Assertions.assertTrue(context.getData("threadName").toString().startsWith("customer-chain-thead"));
+    }
+
+    /**
+     * 测试WHILE上全局线程池和chain线程池隔离-优先以chain上为准
+     */
+    @Test
+    public void testChainThreadPool3() {
+        LiteflowResponse response1 = flowExecutor.execute2Resp("chain3", "arg");
+        DefaultContext context = response1.getFirstContextBean();
+        Assertions.assertTrue(response1.isSuccess());
+        Assertions.assertTrue(context.getData("threadName").toString().startsWith("customer-chain-thead"));
+    }
+
+    /**
+     * 测试ITERATOR上全局线程池和chain线程池隔离-优先以chain上为准
+     */
+    @Test
+    public void testChainThreadPool4() {
+        List<String> list = ListUtil.toList("1", "2", "3", "4", "5");
+        LiteflowResponse response1 = flowExecutor.execute2Resp("chain4", list);
+        DefaultContext context = response1.getFirstContextBean();
+        Assertions.assertTrue(response1.isSuccess());
+        Assertions.assertTrue(context.getData("threadName").toString().startsWith("customer-chain-thead"));
+    }
+
+}

+ 79 - 0
liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/java/com/yomahub/liteflow/test/chainThreadPool/ConditionThreadPoolELSpringbootTest.java

@@ -0,0 +1,79 @@
+package com.yomahub.liteflow.test.chainThreadPool;
+
+import cn.hutool.core.collection.ListUtil;
+import com.yomahub.liteflow.core.FlowExecutor;
+import com.yomahub.liteflow.flow.LiteflowResponse;
+import com.yomahub.liteflow.slot.DefaultContext;
+import com.yomahub.liteflow.test.BaseTest;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.test.context.TestPropertySource;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * springboot环境下chain线程池隔离测试
+ */
+@TestPropertySource(value = "classpath:/chainThreadPool/application2.properties")
+@SpringBootTest(classes = ConditionThreadPoolELSpringbootTest.class)
+@EnableAutoConfiguration
+@ComponentScan({"com.yomahub.liteflow.test.chainThreadPool.cmp"})
+public class ConditionThreadPoolELSpringbootTest extends BaseTest {
+
+    private final Logger log = LoggerFactory.getLogger(this.getClass());
+
+    @Resource
+    private FlowExecutor flowExecutor;
+
+    /**
+     * 测试WEHN上condition线程池和chain线程池隔离-优先以WHEN上为准
+     */
+    @Test
+    public void testConditionThreadPool() {
+        LiteflowResponse response1 = flowExecutor.execute2Resp("chain1", "arg");
+        DefaultContext context = response1.getFirstContextBean();
+        Assertions.assertTrue(response1.isSuccess());
+        Assertions.assertTrue(context.getData("threadName").toString().startsWith("customer-when-thead"));
+    }
+
+    /**
+     * 测试FOR上condition线程池和chain线程池隔离-优先以FOR上为准
+     */
+    @Test
+    public void testConditionThreadPool2() {
+        LiteflowResponse response1 = flowExecutor.execute2Resp("chain2", "arg");
+        DefaultContext context = response1.getFirstContextBean();
+        Assertions.assertTrue(response1.isSuccess());
+        Assertions.assertTrue(context.getData("threadName").toString().startsWith("customer-loop-thead"));
+    }
+
+    /**
+     * 测试WHILE上condition线程池和chain线程池隔离-优先以WHILE上为准
+     */
+    @Test
+    public void testConditionThreadPool3() {
+        LiteflowResponse response1 = flowExecutor.execute2Resp("chain3", "arg");
+        DefaultContext context = response1.getFirstContextBean();
+        Assertions.assertTrue(response1.isSuccess());
+        Assertions.assertTrue(context.getData("threadName").toString().startsWith("customer-loop-thead"));
+    }
+
+    /**
+     * 测试ITERATOR上condition线程池和chain线程池隔离-优先以ITERATOR上为准
+     */
+    @Test
+    public void testConditionThreadPool4() {
+        List<String> list = ListUtil.toList("1", "2", "3", "4", "5");
+        LiteflowResponse response1 = flowExecutor.execute2Resp("chain4", list);
+        DefaultContext context = response1.getFirstContextBean();
+        Assertions.assertTrue(response1.isSuccess());
+        Assertions.assertTrue(context.getData("threadName").toString().startsWith("customer-loop-thead"));
+    }
+
+}

+ 23 - 0
liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/java/com/yomahub/liteflow/test/chainThreadPool/CustomChainThreadExecutor.java

@@ -0,0 +1,23 @@
+package com.yomahub.liteflow.test.chainThreadPool;
+
+import cn.hutool.core.util.ObjectUtil;
+import com.yomahub.liteflow.property.LiteflowConfig;
+import com.yomahub.liteflow.property.LiteflowConfigGetter;
+import com.yomahub.liteflow.thread.ExecutorBuilder;
+
+import java.util.concurrent.ExecutorService;
+
+public class CustomChainThreadExecutor implements ExecutorBuilder {
+
+    @Override
+    public ExecutorService buildExecutor() {
+        LiteflowConfig liteflowConfig = LiteflowConfigGetter.get();
+        // 只有在非spring的场景下liteflowConfig才会为null
+        if (ObjectUtil.isNull(liteflowConfig)) {
+            liteflowConfig = new LiteflowConfig();
+        }
+        return buildDefaultExecutor(16, 16,
+                                    512, "customer-chain-thead");
+    }
+
+}

+ 23 - 0
liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/java/com/yomahub/liteflow/test/chainThreadPool/CustomGlobalThreadExecutor.java

@@ -0,0 +1,23 @@
+package com.yomahub.liteflow.test.chainThreadPool;
+
+import cn.hutool.core.util.ObjectUtil;
+import com.yomahub.liteflow.property.LiteflowConfig;
+import com.yomahub.liteflow.property.LiteflowConfigGetter;
+import com.yomahub.liteflow.thread.ExecutorBuilder;
+
+import java.util.concurrent.ExecutorService;
+
+public class CustomGlobalThreadExecutor implements ExecutorBuilder {
+
+    @Override
+    public ExecutorService buildExecutor() {
+        LiteflowConfig liteflowConfig = LiteflowConfigGetter.get();
+        // 只有在非spring的场景下liteflowConfig才会为null
+        if (ObjectUtil.isNull(liteflowConfig)) {
+            liteflowConfig = new LiteflowConfig();
+        }
+        return buildDefaultExecutor(16, 16,
+                                    512, "customer-global-thead");
+    }
+
+}

+ 23 - 0
liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/java/com/yomahub/liteflow/test/chainThreadPool/CustomLoopThreadExecutor.java

@@ -0,0 +1,23 @@
+package com.yomahub.liteflow.test.chainThreadPool;
+
+import cn.hutool.core.util.ObjectUtil;
+import com.yomahub.liteflow.property.LiteflowConfig;
+import com.yomahub.liteflow.property.LiteflowConfigGetter;
+import com.yomahub.liteflow.thread.ExecutorBuilder;
+
+import java.util.concurrent.ExecutorService;
+
+public class CustomLoopThreadExecutor implements ExecutorBuilder {
+
+    @Override
+    public ExecutorService buildExecutor() {
+        LiteflowConfig liteflowConfig = LiteflowConfigGetter.get();
+        // 只有在非spring的场景下liteflowConfig才会为null
+        if (ObjectUtil.isNull(liteflowConfig)) {
+            liteflowConfig = new LiteflowConfig();
+        }
+        return buildDefaultExecutor(16, 16,
+                                    512, "customer-loop-thead");
+    }
+
+}

+ 23 - 0
liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/java/com/yomahub/liteflow/test/chainThreadPool/CustomWhenThreadExecutor.java

@@ -0,0 +1,23 @@
+package com.yomahub.liteflow.test.chainThreadPool;
+
+import cn.hutool.core.util.ObjectUtil;
+import com.yomahub.liteflow.property.LiteflowConfig;
+import com.yomahub.liteflow.property.LiteflowConfigGetter;
+import com.yomahub.liteflow.thread.ExecutorBuilder;
+
+import java.util.concurrent.ExecutorService;
+
+public class CustomWhenThreadExecutor implements ExecutorBuilder {
+
+    @Override
+    public ExecutorService buildExecutor() {
+        LiteflowConfig liteflowConfig = LiteflowConfigGetter.get();
+        // 只有在非spring的场景下liteflowConfig才会为null
+        if (ObjectUtil.isNull(liteflowConfig)) {
+            liteflowConfig = new LiteflowConfig();
+        }
+        return buildDefaultExecutor(16, 16,
+                                    512, "customer-when-thead");
+    }
+
+}

+ 79 - 0
liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/java/com/yomahub/liteflow/test/chainThreadPool/GlobalThreadPoolELSpringbootTest.java

@@ -0,0 +1,79 @@
+package com.yomahub.liteflow.test.chainThreadPool;
+
+import cn.hutool.core.collection.ListUtil;
+import com.yomahub.liteflow.core.FlowExecutor;
+import com.yomahub.liteflow.flow.LiteflowResponse;
+import com.yomahub.liteflow.slot.DefaultContext;
+import com.yomahub.liteflow.test.BaseTest;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.test.context.TestPropertySource;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * springboot环境下Global线程池隔离测试
+ */
+@TestPropertySource(value = "classpath:/chainThreadPool/application3.properties")
+@SpringBootTest(classes = GlobalThreadPoolELSpringbootTest.class)
+@EnableAutoConfiguration
+@ComponentScan({"com.yomahub.liteflow.test.chainThreadPool.cmp"})
+public class GlobalThreadPoolELSpringbootTest extends BaseTest {
+
+    private final Logger log = LoggerFactory.getLogger(this.getClass());
+
+    @Resource
+    private FlowExecutor flowExecutor;
+
+    /**
+     * 测试WHEN上全局线程池
+     */
+    @Test
+    public void testGlobalThreadPool() {
+        LiteflowResponse response1 = flowExecutor.execute2Resp("chain1", "arg");
+        DefaultContext context = response1.getFirstContextBean();
+        Assertions.assertTrue(response1.isSuccess());
+        Assertions.assertTrue(context.getData("threadName").toString().startsWith("customer-global-thead"));
+    }
+
+    /**
+     * 测试FOR上全局线程池
+     */
+    @Test
+    public void testGlobalThreadPool2() {
+        LiteflowResponse response1 = flowExecutor.execute2Resp("chain2", "arg");
+        DefaultContext context = response1.getFirstContextBean();
+        Assertions.assertTrue(response1.isSuccess());
+        Assertions.assertTrue(context.getData("threadName").toString().startsWith("customer-global-thead"));
+    }
+
+    /**
+     * 测试WHILE上全局线程池
+     */
+    @Test
+    public void testGlobalThreadPool3() {
+        LiteflowResponse response1 = flowExecutor.execute2Resp("chain3", "arg");
+        DefaultContext context = response1.getFirstContextBean();
+        Assertions.assertTrue(response1.isSuccess());
+        Assertions.assertTrue(context.getData("threadName").toString().startsWith("customer-global-thead"));
+    }
+
+    /**
+     * 测试ITERATOR上全局线程池
+     */
+    @Test
+    public void testGlobalThreadPool4() {
+        List<String> list = ListUtil.toList("1", "2", "3", "4", "5");
+        LiteflowResponse response1 = flowExecutor.execute2Resp("chain4", list);
+        DefaultContext context = response1.getFirstContextBean();
+        Assertions.assertTrue(response1.isSuccess());
+        Assertions.assertTrue(context.getData("threadName").toString().startsWith("customer-global-thead"));
+    }
+
+}

+ 81 - 0
liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/java/com/yomahub/liteflow/test/chainThreadPool/cmp/CmpConfig.java

@@ -0,0 +1,81 @@
+package com.yomahub.liteflow.test.chainThreadPool.cmp;
+
+import com.yomahub.liteflow.annotation.LiteflowComponent;
+import com.yomahub.liteflow.annotation.LiteflowMethod;
+import com.yomahub.liteflow.core.NodeComponent;
+import com.yomahub.liteflow.enums.LiteFlowMethodEnum;
+import com.yomahub.liteflow.enums.NodeTypeEnum;
+import com.yomahub.liteflow.slot.DefaultContext;
+
+import java.util.Iterator;
+import java.util.List;
+
+@LiteflowComponent
+public class CmpConfig {
+
+    @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "a")
+    public void processA(NodeComponent bindCmp) {
+
+        System.out.println("ACmp executed!");
+    }
+
+    @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "b")
+    public void processB(NodeComponent bindCmp) {
+        DefaultContext context = bindCmp.getFirstContextBean();
+        context.setData("threadName", Thread.currentThread().getName());
+        System.out.println("BCmp executed!");
+    }
+
+
+    @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "d")
+    public void processD(NodeComponent bindCmp) {
+        DefaultContext context = bindCmp.getFirstContextBean();
+        String key = "test";
+        if (context.hasData(key)) {
+            int count = context.getData(key);
+            context.setData(key, ++count);
+        } else {
+            context.setData(key, 1);
+        }
+    }
+
+    @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "f")
+    public void processE(NodeComponent bindCmp) {
+        DefaultContext context = bindCmp.getFirstContextBean();
+        context.setData("threadName", Thread.currentThread().getName());
+        System.out.println("FCmp executed!");
+    }
+
+    @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "i")
+    public void processI(NodeComponent bindCmp) {
+        DefaultContext context = bindCmp.getFirstContextBean();
+        context.setData("threadName", Thread.currentThread().getName());
+        System.out.println("ICmp executed!");
+    }
+
+    @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS_ITERATOR, nodeId = "it", nodeType = NodeTypeEnum.ITERATOR)
+    public Iterator<String> processIT(NodeComponent bindCmp) {
+        List<String> list = bindCmp.getRequestData();
+        return list.iterator();
+    }
+
+    @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "w")
+    public void processW(NodeComponent bindCmp) {
+        DefaultContext context = bindCmp.getFirstContextBean();
+        context.setData("threadName", Thread.currentThread().getName());
+        System.out.println("WCmp executed!");
+    }
+
+    @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS_BOOLEAN, nodeId = "z", nodeType = NodeTypeEnum.BOOLEAN)
+    public boolean processZ(NodeComponent bindCmp) {
+        DefaultContext context = bindCmp.getFirstContextBean();
+        String key = "test";
+        if (context.hasData(key)) {
+            int count = context.getData("test");
+            return count < 5;
+        } else {
+            return true;
+        }
+    }
+
+}

+ 2 - 2
liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/java/com/yomahub/liteflow/test/customWhenThreadPool/CustomThreadExecutor1.java

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

+ 2 - 2
liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/java/com/yomahub/liteflow/test/customWhenThreadPool/CustomThreadExecutor2.java

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

+ 2 - 2
liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/java/com/yomahub/liteflow/test/customWhenThreadPool/CustomThreadExecutor3.java

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

+ 2 - 3
liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/java/com/yomahub/liteflow/test/customWhenThreadPool/CustomWhenThreadPoolELDeclMultiSpringbootTest.java

@@ -7,14 +7,13 @@ import com.yomahub.liteflow.test.BaseTest;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.extension.ExtendWith;
 import org.junit.jupiter.api.extension.ExtendWith;
-import org.springframework.test.context.junit.jupiter.SpringExtension;
 import org.slf4j.Logger;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.slf4j.LoggerFactory;
 import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
 import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.context.annotation.ComponentScan;
 import org.springframework.context.annotation.ComponentScan;
 import org.springframework.test.context.TestPropertySource;
 import org.springframework.test.context.TestPropertySource;
-import org.springframework.test.context.junit4.SpringRunner;
+import org.springframework.test.context.junit.jupiter.SpringExtension;
 
 
 import javax.annotation.Resource;
 import javax.annotation.Resource;
 
 
@@ -44,7 +43,7 @@ public class CustomWhenThreadPoolELDeclMultiSpringbootTest extends BaseTest {
 		LiteflowResponse response = flowExecutor.execute2Resp("chain", "arg");
 		LiteflowResponse response = flowExecutor.execute2Resp("chain", "arg");
 		DefaultContext context = response.getFirstContextBean();
 		DefaultContext context = response.getFirstContextBean();
 		Assertions.assertTrue(response.isSuccess());
 		Assertions.assertTrue(response.isSuccess());
-		Assertions.assertTrue(context.getData("threadName").toString().startsWith("when-thread-1"));
+		Assertions.assertTrue(context.getData("threadName").toString().startsWith("global-thread-1"));
 	}
 	}
 
 
 	/**
 	/**

+ 2 - 2
liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/java/com/yomahub/liteflow/test/parallelLoop/CustomThreadExecutor.java

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

+ 1 - 0
liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/chainThreadPool/application.properties

@@ -0,0 +1 @@
+liteflow.rule-source=chainThreadPool/flow.el.xml

+ 2 - 0
liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/chainThreadPool/application2.properties

@@ -0,0 +1,2 @@
+liteflow.rule-source=chainThreadPool/flow2.el.xml
+liteflow.when-thread-pool-isolate=true

+ 4 - 0
liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/chainThreadPool/application3.properties

@@ -0,0 +1,4 @@
+liteflow.rule-source=chainThreadPool/flow3.el.xml
+liteflow.global-thread-pool-size=16
+liteflow.global-thread-pool-queue-size=512
+liteflow.global-thread-pool-executor-class=com.yomahub.liteflow.test.chainThreadPool.CustomGlobalThreadExecutor

+ 22 - 0
liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/chainThreadPool/flow.el.xml

@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<flow>
+    <chain name="chain1"
+           thread-pool-executor-class="com.yomahub.liteflow.test.chainThreadPool.CustomChainThreadExecutor">
+        WHEN(a,b);
+    </chain>
+
+    <chain name="chain2"
+           thread-pool-executor-class="com.yomahub.liteflow.test.chainThreadPool.CustomChainThreadExecutor">
+        FOR(5).parallel(true).DO(THEN(a,f));
+    </chain>
+
+    <chain name="chain3"
+           thread-pool-executor-class="com.yomahub.liteflow.test.chainThreadPool.CustomChainThreadExecutor">
+        WHILE(z).parallel(true).DO(THEN(w,d));
+    </chain>
+
+    <chain name="chain4"
+           thread-pool-executor-class="com.yomahub.liteflow.test.chainThreadPool.CustomChainThreadExecutor">
+        ITERATOR(it).parallel(true).DO(THEN(a,i));
+    </chain>
+</flow>

+ 22 - 0
liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/chainThreadPool/flow2.el.xml

@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<flow>
+    <chain name="chain1"
+           thread-pool-executor-class="com.yomahub.liteflow.test.chainThreadPool.CustomChainThreadExecutor">
+        WHEN(a,b).threadPool("com.yomahub.liteflow.test.chainThreadPool.CustomWhenThreadExecutor");
+    </chain>
+
+    <chain name="chain2"
+           thread-pool-executor-class="com.yomahub.liteflow.test.chainThreadPool.CustomChainThreadExecutor">
+        FOR(5).parallel(true).DO(THEN(a,f)).threadPool("com.yomahub.liteflow.test.chainThreadPool.CustomLoopThreadExecutor");
+    </chain>
+
+    <chain name="chain3"
+           thread-pool-executor-class="com.yomahub.liteflow.test.chainThreadPool.CustomChainThreadExecutor">
+        WHILE(z).parallel(true).DO(THEN(w,d)).threadPool("com.yomahub.liteflow.test.chainThreadPool.CustomLoopThreadExecutor");
+    </chain>
+
+    <chain name="chain4"
+           thread-pool-executor-class="com.yomahub.liteflow.test.chainThreadPool.CustomChainThreadExecutor">
+        ITERATOR(it).parallel(true).DO(THEN(a,i)).threadPool("com.yomahub.liteflow.test.chainThreadPool.CustomLoopThreadExecutor");
+    </chain>
+</flow>

+ 19 - 0
liteflow-testcase-el/liteflow-testcase-el-declare-multi-springboot/src/test/resources/chainThreadPool/flow3.el.xml

@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<flow>
+    <chain name="chain1">
+        WHEN(a,b);
+    </chain>
+
+    <chain name="chain2">
+        FOR(5).parallel(true).DO(THEN(a,f)
+        );
+    </chain>
+
+    <chain name="chain3">
+        WHILE(z).parallel(true).DO(THEN(w,d));
+    </chain>
+
+    <chain name="chain4">
+        ITERATOR(it).parallel(true).DO(THEN(a,i));
+    </chain>
+</flow>

+ 79 - 0
liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/chainThreadPool/ChainThreadPoolELSpringbootTest.java

@@ -0,0 +1,79 @@
+package com.yomahub.liteflow.test.chainThreadPool;
+
+import cn.hutool.core.collection.ListUtil;
+import com.yomahub.liteflow.core.FlowExecutor;
+import com.yomahub.liteflow.flow.LiteflowResponse;
+import com.yomahub.liteflow.slot.DefaultContext;
+import com.yomahub.liteflow.test.BaseTest;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.test.context.TestPropertySource;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * springboot环境下chain线程池隔离测试
+ */
+@TestPropertySource(value = "classpath:/chainThreadPool/application.properties")
+@SpringBootTest(classes = ChainThreadPoolELSpringbootTest.class)
+@EnableAutoConfiguration
+@ComponentScan({"com.yomahub.liteflow.test.chainThreadPool.cmp"})
+public class ChainThreadPoolELSpringbootTest extends BaseTest {
+
+    private final Logger log = LoggerFactory.getLogger(this.getClass());
+
+    @Resource
+    private FlowExecutor flowExecutor;
+
+    /**
+     * 测试WHEN上全局线程池和chain线程池隔离-优先以chain上为准
+     */
+    @Test
+    public void testChainThreadPool() {
+        LiteflowResponse response1 = flowExecutor.execute2Resp("chain1", "arg");
+        DefaultContext context = response1.getFirstContextBean();
+        Assertions.assertTrue(response1.isSuccess());
+        Assertions.assertTrue(context.getData("threadName").toString().startsWith("customer-chain-thead"));
+    }
+
+    /**
+     * 测试FOR上全局线程池和chain线程池隔离-优先以chain上为准
+     */
+    @Test
+    public void testChainThreadPool2() {
+        LiteflowResponse response1 = flowExecutor.execute2Resp("chain2", "arg");
+        DefaultContext context = response1.getFirstContextBean();
+        Assertions.assertTrue(response1.isSuccess());
+        Assertions.assertTrue(context.getData("threadName").toString().startsWith("customer-chain-thead"));
+    }
+
+    /**
+     * 测试WHILE上全局线程池和chain线程池隔离-优先以chain上为准
+     */
+    @Test
+    public void testChainThreadPool3() {
+        LiteflowResponse response1 = flowExecutor.execute2Resp("chain3", "arg");
+        DefaultContext context = response1.getFirstContextBean();
+        Assertions.assertTrue(response1.isSuccess());
+        Assertions.assertTrue(context.getData("threadName").toString().startsWith("customer-chain-thead"));
+    }
+
+    /**
+     * 测试ITERATOR上全局线程池和chain线程池隔离-优先以chain上为准
+     */
+    @Test
+    public void testChainThreadPool4() {
+        List<String> list = ListUtil.toList("1", "2", "3", "4", "5");
+        LiteflowResponse response1 = flowExecutor.execute2Resp("chain4", list);
+        DefaultContext context = response1.getFirstContextBean();
+        Assertions.assertTrue(response1.isSuccess());
+        Assertions.assertTrue(context.getData("threadName").toString().startsWith("customer-chain-thead"));
+    }
+
+}

+ 79 - 0
liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/chainThreadPool/ConditionThreadPoolELSpringbootTest.java

@@ -0,0 +1,79 @@
+package com.yomahub.liteflow.test.chainThreadPool;
+
+import cn.hutool.core.collection.ListUtil;
+import com.yomahub.liteflow.core.FlowExecutor;
+import com.yomahub.liteflow.flow.LiteflowResponse;
+import com.yomahub.liteflow.slot.DefaultContext;
+import com.yomahub.liteflow.test.BaseTest;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.test.context.TestPropertySource;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * springboot环境下chain线程池隔离测试
+ */
+@TestPropertySource(value = "classpath:/chainThreadPool/application2.properties")
+@SpringBootTest(classes = ConditionThreadPoolELSpringbootTest.class)
+@EnableAutoConfiguration
+@ComponentScan({"com.yomahub.liteflow.test.chainThreadPool.cmp"})
+public class ConditionThreadPoolELSpringbootTest extends BaseTest {
+
+    private final Logger log = LoggerFactory.getLogger(this.getClass());
+
+    @Resource
+    private FlowExecutor flowExecutor;
+
+    /**
+     * 测试WEHN上condition线程池和chain线程池隔离-优先以WHEN上为准
+     */
+    @Test
+    public void testConditionThreadPool() {
+        LiteflowResponse response1 = flowExecutor.execute2Resp("chain1", "arg");
+        DefaultContext context = response1.getFirstContextBean();
+        Assertions.assertTrue(response1.isSuccess());
+        Assertions.assertTrue(context.getData("threadName").toString().startsWith("customer-when-thead"));
+    }
+
+    /**
+     * 测试FOR上condition线程池和chain线程池隔离-优先以FOR上为准
+     */
+    @Test
+    public void testConditionThreadPool2() {
+        LiteflowResponse response1 = flowExecutor.execute2Resp("chain2", "arg");
+        DefaultContext context = response1.getFirstContextBean();
+        Assertions.assertTrue(response1.isSuccess());
+        Assertions.assertTrue(context.getData("threadName").toString().startsWith("customer-loop-thead"));
+    }
+
+    /**
+     * 测试WHILE上condition线程池和chain线程池隔离-优先以WHILE上为准
+     */
+    @Test
+    public void testConditionThreadPool3() {
+        LiteflowResponse response1 = flowExecutor.execute2Resp("chain3", "arg");
+        DefaultContext context = response1.getFirstContextBean();
+        Assertions.assertTrue(response1.isSuccess());
+        Assertions.assertTrue(context.getData("threadName").toString().startsWith("customer-loop-thead"));
+    }
+
+    /**
+     * 测试ITERATOR上condition线程池和chain线程池隔离-优先以ITERATOR上为准
+     */
+    @Test
+    public void testConditionThreadPool4() {
+        List<String> list = ListUtil.toList("1", "2", "3", "4", "5");
+        LiteflowResponse response1 = flowExecutor.execute2Resp("chain4", list);
+        DefaultContext context = response1.getFirstContextBean();
+        Assertions.assertTrue(response1.isSuccess());
+        Assertions.assertTrue(context.getData("threadName").toString().startsWith("customer-loop-thead"));
+    }
+
+}

+ 23 - 0
liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/chainThreadPool/CustomChainThreadExecutor.java

@@ -0,0 +1,23 @@
+package com.yomahub.liteflow.test.chainThreadPool;
+
+import cn.hutool.core.util.ObjectUtil;
+import com.yomahub.liteflow.property.LiteflowConfig;
+import com.yomahub.liteflow.property.LiteflowConfigGetter;
+import com.yomahub.liteflow.thread.ExecutorBuilder;
+
+import java.util.concurrent.ExecutorService;
+
+public class CustomChainThreadExecutor implements ExecutorBuilder {
+
+    @Override
+    public ExecutorService buildExecutor() {
+        LiteflowConfig liteflowConfig = LiteflowConfigGetter.get();
+        // 只有在非spring的场景下liteflowConfig才会为null
+        if (ObjectUtil.isNull(liteflowConfig)) {
+            liteflowConfig = new LiteflowConfig();
+        }
+        return buildDefaultExecutor(16, 16,
+                                    512, "customer-chain-thead");
+    }
+
+}

+ 23 - 0
liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/chainThreadPool/CustomGlobalThreadExecutor.java

@@ -0,0 +1,23 @@
+package com.yomahub.liteflow.test.chainThreadPool;
+
+import cn.hutool.core.util.ObjectUtil;
+import com.yomahub.liteflow.property.LiteflowConfig;
+import com.yomahub.liteflow.property.LiteflowConfigGetter;
+import com.yomahub.liteflow.thread.ExecutorBuilder;
+
+import java.util.concurrent.ExecutorService;
+
+public class CustomGlobalThreadExecutor implements ExecutorBuilder {
+
+    @Override
+    public ExecutorService buildExecutor() {
+        LiteflowConfig liteflowConfig = LiteflowConfigGetter.get();
+        // 只有在非spring的场景下liteflowConfig才会为null
+        if (ObjectUtil.isNull(liteflowConfig)) {
+            liteflowConfig = new LiteflowConfig();
+        }
+        return buildDefaultExecutor(16, 16,
+                                    512, "customer-global-thead");
+    }
+
+}

+ 23 - 0
liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/chainThreadPool/CustomLoopThreadExecutor.java

@@ -0,0 +1,23 @@
+package com.yomahub.liteflow.test.chainThreadPool;
+
+import cn.hutool.core.util.ObjectUtil;
+import com.yomahub.liteflow.property.LiteflowConfig;
+import com.yomahub.liteflow.property.LiteflowConfigGetter;
+import com.yomahub.liteflow.thread.ExecutorBuilder;
+
+import java.util.concurrent.ExecutorService;
+
+public class CustomLoopThreadExecutor implements ExecutorBuilder {
+
+    @Override
+    public ExecutorService buildExecutor() {
+        LiteflowConfig liteflowConfig = LiteflowConfigGetter.get();
+        // 只有在非spring的场景下liteflowConfig才会为null
+        if (ObjectUtil.isNull(liteflowConfig)) {
+            liteflowConfig = new LiteflowConfig();
+        }
+        return buildDefaultExecutor(16, 16,
+                                    512, "customer-loop-thead");
+    }
+
+}

+ 23 - 0
liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/chainThreadPool/CustomWhenThreadExecutor.java

@@ -0,0 +1,23 @@
+package com.yomahub.liteflow.test.chainThreadPool;
+
+import cn.hutool.core.util.ObjectUtil;
+import com.yomahub.liteflow.property.LiteflowConfig;
+import com.yomahub.liteflow.property.LiteflowConfigGetter;
+import com.yomahub.liteflow.thread.ExecutorBuilder;
+
+import java.util.concurrent.ExecutorService;
+
+public class CustomWhenThreadExecutor implements ExecutorBuilder {
+
+    @Override
+    public ExecutorService buildExecutor() {
+        LiteflowConfig liteflowConfig = LiteflowConfigGetter.get();
+        // 只有在非spring的场景下liteflowConfig才会为null
+        if (ObjectUtil.isNull(liteflowConfig)) {
+            liteflowConfig = new LiteflowConfig();
+        }
+        return buildDefaultExecutor(16, 16,
+                                    512, "customer-when-thead");
+    }
+
+}

+ 79 - 0
liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/chainThreadPool/GlobalThreadPoolELSpringbootTest.java

@@ -0,0 +1,79 @@
+package com.yomahub.liteflow.test.chainThreadPool;
+
+import cn.hutool.core.collection.ListUtil;
+import com.yomahub.liteflow.core.FlowExecutor;
+import com.yomahub.liteflow.flow.LiteflowResponse;
+import com.yomahub.liteflow.slot.DefaultContext;
+import com.yomahub.liteflow.test.BaseTest;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.test.context.TestPropertySource;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * springboot环境下Global线程池隔离测试
+ */
+@TestPropertySource(value = "classpath:/chainThreadPool/application3.properties")
+@SpringBootTest(classes = GlobalThreadPoolELSpringbootTest.class)
+@EnableAutoConfiguration
+@ComponentScan({"com.yomahub.liteflow.test.chainThreadPool.cmp"})
+public class GlobalThreadPoolELSpringbootTest extends BaseTest {
+
+    private final Logger log = LoggerFactory.getLogger(this.getClass());
+
+    @Resource
+    private FlowExecutor flowExecutor;
+
+    /**
+     * 测试WHEN上全局线程池
+     */
+    @Test
+    public void testGlobalThreadPool() {
+        LiteflowResponse response1 = flowExecutor.execute2Resp("chain1", "arg");
+        DefaultContext context = response1.getFirstContextBean();
+        Assertions.assertTrue(response1.isSuccess());
+        Assertions.assertTrue(context.getData("threadName").toString().startsWith("customer-global-thead"));
+    }
+
+    /**
+     * 测试FOR上全局线程池
+     */
+    @Test
+    public void testGlobalThreadPool2() {
+        LiteflowResponse response1 = flowExecutor.execute2Resp("chain2", "arg");
+        DefaultContext context = response1.getFirstContextBean();
+        Assertions.assertTrue(response1.isSuccess());
+        Assertions.assertTrue(context.getData("threadName").toString().startsWith("customer-global-thead"));
+    }
+
+    /**
+     * 测试WHILE上全局线程池
+     */
+    @Test
+    public void testGlobalThreadPool3() {
+        LiteflowResponse response1 = flowExecutor.execute2Resp("chain3", "arg");
+        DefaultContext context = response1.getFirstContextBean();
+        Assertions.assertTrue(response1.isSuccess());
+        Assertions.assertTrue(context.getData("threadName").toString().startsWith("customer-global-thead"));
+    }
+
+    /**
+     * 测试ITERATOR上全局线程池
+     */
+    @Test
+    public void testGlobalThreadPool4() {
+        List<String> list = ListUtil.toList("1", "2", "3", "4", "5");
+        LiteflowResponse response1 = flowExecutor.execute2Resp("chain4", list);
+        DefaultContext context = response1.getFirstContextBean();
+        Assertions.assertTrue(response1.isSuccess());
+        Assertions.assertTrue(context.getData("threadName").toString().startsWith("customer-global-thead"));
+    }
+
+}

+ 24 - 0
liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/chainThreadPool/cmp/ACmp.java

@@ -0,0 +1,24 @@
+/**
+ * <p>Title: liteflow</p>
+ * <p>Description: 轻量级的组件式流程框架</p>
+ *
+ * @author Bryan.Zhang
+ * @email weenyc31@163.com
+ * @Date 2020/4/1
+ */
+package com.yomahub.liteflow.test.chainThreadPool.cmp;
+
+import com.yomahub.liteflow.annotation.LiteflowMethod;
+import com.yomahub.liteflow.core.NodeComponent;
+import com.yomahub.liteflow.enums.LiteFlowMethodEnum;
+import org.springframework.stereotype.Component;
+
+@Component("a")
+public class ACmp {
+
+    @LiteflowMethod(LiteFlowMethodEnum.PROCESS)
+    public void process(NodeComponent bindCmp) {
+        System.out.println("ACmp executed!");
+    }
+
+}

+ 27 - 0
liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/chainThreadPool/cmp/BCmp.java

@@ -0,0 +1,27 @@
+/**
+ * <p>Title: liteflow</p>
+ * <p>Description: 轻量级的组件式流程框架</p>
+ *
+ * @author Bryan.Zhang
+ * @email weenyc31@163.com
+ * @Date 2020/4/1
+ */
+package com.yomahub.liteflow.test.chainThreadPool.cmp;
+
+import com.yomahub.liteflow.annotation.LiteflowMethod;
+import com.yomahub.liteflow.core.NodeComponent;
+import com.yomahub.liteflow.enums.LiteFlowMethodEnum;
+import com.yomahub.liteflow.slot.DefaultContext;
+import org.springframework.stereotype.Component;
+
+@Component("b")
+public class BCmp {
+
+    @LiteflowMethod(LiteFlowMethodEnum.PROCESS)
+    public void process(NodeComponent bindCmp) {
+        DefaultContext context = bindCmp.getFirstContextBean();
+        context.setData("threadName", Thread.currentThread().getName());
+        System.out.println("BCmp executed!");
+    }
+
+}

+ 81 - 0
liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/chainThreadPool/cmp/CmpConfig.java

@@ -0,0 +1,81 @@
+package com.yomahub.liteflow.test.chainThreadPool.cmp;
+
+import com.yomahub.liteflow.annotation.LiteflowComponent;
+import com.yomahub.liteflow.annotation.LiteflowMethod;
+import com.yomahub.liteflow.core.NodeComponent;
+import com.yomahub.liteflow.enums.LiteFlowMethodEnum;
+import com.yomahub.liteflow.enums.NodeTypeEnum;
+import com.yomahub.liteflow.slot.DefaultContext;
+
+import java.util.Iterator;
+import java.util.List;
+
+@LiteflowComponent
+public class CmpConfig {
+
+    @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "a")
+    public void processA(NodeComponent bindCmp) {
+
+        System.out.println("ACmp executed!");
+    }
+
+    @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "b")
+    public void processB(NodeComponent bindCmp) {
+        DefaultContext context = bindCmp.getFirstContextBean();
+        context.setData("threadName", Thread.currentThread().getName());
+        System.out.println("BCmp executed!");
+    }
+
+
+    @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "d")
+    public void processD(NodeComponent bindCmp) {
+        DefaultContext context = bindCmp.getFirstContextBean();
+        String key = "test";
+        if (context.hasData(key)) {
+            int count = context.getData(key);
+            context.setData(key, ++count);
+        } else {
+            context.setData(key, 1);
+        }
+    }
+
+    @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "f")
+    public void processE(NodeComponent bindCmp) {
+        DefaultContext context = bindCmp.getFirstContextBean();
+        context.setData("threadName", Thread.currentThread().getName());
+        System.out.println("FCmp executed!");
+    }
+
+    @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "i")
+    public void processI(NodeComponent bindCmp) {
+        DefaultContext context = bindCmp.getFirstContextBean();
+        context.setData("threadName", Thread.currentThread().getName());
+        System.out.println("ICmp executed!");
+    }
+
+    @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS_ITERATOR, nodeId = "it", nodeType = NodeTypeEnum.ITERATOR)
+    public Iterator<String> processIT(NodeComponent bindCmp) {
+        List<String> list = bindCmp.getRequestData();
+        return list.iterator();
+    }
+
+    @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "w")
+    public void processW(NodeComponent bindCmp) {
+        DefaultContext context = bindCmp.getFirstContextBean();
+        context.setData("threadName", Thread.currentThread().getName());
+        System.out.println("WCmp executed!");
+    }
+
+    @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS_BOOLEAN, nodeId = "z", nodeType = NodeTypeEnum.BOOLEAN)
+    public boolean processZ(NodeComponent bindCmp) {
+        DefaultContext context = bindCmp.getFirstContextBean();
+        String key = "test";
+        if (context.hasData(key)) {
+            int count = context.getData("test");
+            return count < 5;
+        } else {
+            return true;
+        }
+    }
+
+}

+ 32 - 0
liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/chainThreadPool/cmp/DCmp.java

@@ -0,0 +1,32 @@
+/**
+ * <p>Title: liteflow</p>
+ * <p>Description: 轻量级的组件式流程框架</p>
+ *
+ * @author Bryan.Zhang
+ * @email weenyc31@163.com
+ * @Date 2020/4/1
+ */
+package com.yomahub.liteflow.test.chainThreadPool.cmp;
+
+import com.yomahub.liteflow.annotation.LiteflowMethod;
+import com.yomahub.liteflow.core.NodeComponent;
+import com.yomahub.liteflow.enums.LiteFlowMethodEnum;
+import com.yomahub.liteflow.slot.DefaultContext;
+import org.springframework.stereotype.Component;
+
+@Component("d")
+public class DCmp {
+
+    @LiteflowMethod(LiteFlowMethodEnum.PROCESS)
+    public void process(NodeComponent bindCmp) {
+        DefaultContext context = bindCmp.getFirstContextBean();
+        String key = "test";
+        if (context.hasData(key)) {
+            int count = context.getData(key);
+            context.setData(key, ++count);
+        } else {
+            context.setData(key, 1);
+        }
+    }
+
+}

+ 19 - 0
liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/chainThreadPool/cmp/FCmp.java

@@ -0,0 +1,19 @@
+package com.yomahub.liteflow.test.chainThreadPool.cmp;
+
+import com.yomahub.liteflow.annotation.LiteflowMethod;
+import com.yomahub.liteflow.core.NodeComponent;
+import com.yomahub.liteflow.enums.LiteFlowMethodEnum;
+import com.yomahub.liteflow.slot.DefaultContext;
+import org.springframework.stereotype.Component;
+
+@Component("f")
+public class FCmp {
+
+    @LiteflowMethod(LiteFlowMethodEnum.PROCESS)
+    public void process(NodeComponent bindCmp) {
+        DefaultContext context = bindCmp.getFirstContextBean();
+        context.setData("threadName", Thread.currentThread().getName());
+        System.out.println("FCmp executed!");
+    }
+
+}

+ 27 - 0
liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/chainThreadPool/cmp/ICmp.java

@@ -0,0 +1,27 @@
+/**
+ * <p>Title: liteflow</p>
+ * <p>Description: 轻量级的组件式流程框架</p>
+ *
+ * @author Bryan.Zhang
+ * @email weenyc31@163.com
+ * @Date 2020/4/1
+ */
+package com.yomahub.liteflow.test.chainThreadPool.cmp;
+
+import com.yomahub.liteflow.annotation.LiteflowMethod;
+import com.yomahub.liteflow.core.NodeComponent;
+import com.yomahub.liteflow.enums.LiteFlowMethodEnum;
+import com.yomahub.liteflow.slot.DefaultContext;
+import org.springframework.stereotype.Component;
+
+@Component("i")
+public class ICmp {
+
+    @LiteflowMethod(LiteFlowMethodEnum.PROCESS)
+    public void process(NodeComponent bindCmp) {
+        DefaultContext context = bindCmp.getFirstContextBean();
+        context.setData("threadName", Thread.currentThread().getName());
+        System.out.println("ICmp executed!");
+    }
+
+}

+ 23 - 0
liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/chainThreadPool/cmp/ITCmp.java

@@ -0,0 +1,23 @@
+package com.yomahub.liteflow.test.chainThreadPool.cmp;
+
+import com.yomahub.liteflow.annotation.LiteflowCmpDefine;
+import com.yomahub.liteflow.annotation.LiteflowMethod;
+import com.yomahub.liteflow.core.NodeComponent;
+import com.yomahub.liteflow.enums.LiteFlowMethodEnum;
+import com.yomahub.liteflow.enums.NodeTypeEnum;
+import org.springframework.stereotype.Component;
+
+import java.util.Iterator;
+import java.util.List;
+
+@Component("it")
+@LiteflowCmpDefine(NodeTypeEnum.ITERATOR)
+public class ITCmp {
+
+    @LiteflowMethod(LiteFlowMethodEnum.PROCESS_ITERATOR)
+    public Iterator<?> processIterator(NodeComponent bindCmp) throws Exception {
+        List<String> list = bindCmp.getRequestData();
+        return list.iterator();
+    }
+
+}

+ 27 - 0
liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/chainThreadPool/cmp/WCmp.java

@@ -0,0 +1,27 @@
+/**
+ * <p>Title: liteflow</p>
+ * <p>Description: 轻量级的组件式流程框架</p>
+ *
+ * @author Bryan.Zhang
+ * @email weenyc31@163.com
+ * @Date 2020/4/1
+ */
+package com.yomahub.liteflow.test.chainThreadPool.cmp;
+
+import com.yomahub.liteflow.annotation.LiteflowMethod;
+import com.yomahub.liteflow.core.NodeComponent;
+import com.yomahub.liteflow.enums.LiteFlowMethodEnum;
+import com.yomahub.liteflow.slot.DefaultContext;
+import org.springframework.stereotype.Component;
+
+@Component("w")
+public class WCmp {
+
+    @LiteflowMethod(LiteFlowMethodEnum.PROCESS)
+    public void process(NodeComponent bindCmp) {
+        DefaultContext context = bindCmp.getFirstContextBean();
+        context.setData("threadName", Thread.currentThread().getName());
+        System.out.println("WCmp executed!");
+    }
+
+}

+ 25 - 0
liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/chainThreadPool/cmp/ZCmp.java

@@ -0,0 +1,25 @@
+package com.yomahub.liteflow.test.chainThreadPool.cmp;
+
+import com.yomahub.liteflow.annotation.LiteflowComponent;
+import com.yomahub.liteflow.annotation.LiteflowMethod;
+import com.yomahub.liteflow.core.NodeComponent;
+import com.yomahub.liteflow.enums.LiteFlowMethodEnum;
+import com.yomahub.liteflow.enums.NodeTypeEnum;
+import com.yomahub.liteflow.slot.DefaultContext;
+
+@LiteflowComponent("z")
+public class ZCmp {
+
+    @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS_BOOLEAN, nodeType = NodeTypeEnum.BOOLEAN)
+    public boolean processWhile(NodeComponent bindCmp) throws Exception {
+        DefaultContext context = bindCmp.getFirstContextBean();
+        String key = "test";
+        if (context.hasData(key)) {
+            int count = context.getData("test");
+            return count < 5;
+        } else {
+            return true;
+        }
+    }
+
+}

+ 2 - 2
liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/customWhenThreadPool/CustomThreadExecutor1.java

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

+ 2 - 2
liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/customWhenThreadPool/CustomThreadExecutor2.java

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

+ 2 - 2
liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/customWhenThreadPool/CustomThreadExecutor3.java

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

+ 2 - 3
liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/customWhenThreadPool/CustomWhenThreadPoolELDeclSpringbootTest.java

@@ -7,14 +7,13 @@ import com.yomahub.liteflow.test.BaseTest;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.extension.ExtendWith;
 import org.junit.jupiter.api.extension.ExtendWith;
-import org.springframework.test.context.junit.jupiter.SpringExtension;
 import org.slf4j.Logger;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.slf4j.LoggerFactory;
 import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
 import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.context.annotation.ComponentScan;
 import org.springframework.context.annotation.ComponentScan;
 import org.springframework.test.context.TestPropertySource;
 import org.springframework.test.context.TestPropertySource;
-import org.springframework.test.context.junit4.SpringRunner;
+import org.springframework.test.context.junit.jupiter.SpringExtension;
 
 
 import javax.annotation.Resource;
 import javax.annotation.Resource;
 
 
@@ -44,7 +43,7 @@ public class CustomWhenThreadPoolELDeclSpringbootTest extends BaseTest {
 		LiteflowResponse response = flowExecutor.execute2Resp("chain", "arg");
 		LiteflowResponse response = flowExecutor.execute2Resp("chain", "arg");
 		DefaultContext context = response.getFirstContextBean();
 		DefaultContext context = response.getFirstContextBean();
 		Assertions.assertTrue(response.isSuccess());
 		Assertions.assertTrue(response.isSuccess());
-		Assertions.assertTrue(context.getData("threadName").toString().startsWith("when-thread-1"));
+        Assertions.assertTrue(context.getData("threadName").toString().startsWith("global-thread-1"));
 	}
 	}
 
 
 	/**
 	/**

+ 2 - 2
liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/java/com/yomahub/liteflow/test/parallelLoop/CustomThreadExecutor.java

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

+ 1 - 0
liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/resources/chainThreadPool/application.properties

@@ -0,0 +1 @@
+liteflow.rule-source=chainThreadPool/flow.el.xml

+ 2 - 0
liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/resources/chainThreadPool/application2.properties

@@ -0,0 +1,2 @@
+liteflow.rule-source=chainThreadPool/flow2.el.xml
+liteflow.when-thread-pool-isolate=true

+ 4 - 0
liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/resources/chainThreadPool/application3.properties

@@ -0,0 +1,4 @@
+liteflow.rule-source=chainThreadPool/flow3.el.xml
+liteflow.global-thread-pool-size=16
+liteflow.global-thread-pool-queue-size=512
+liteflow.global-thread-pool-executor-class=com.yomahub.liteflow.test.chainThreadPool.CustomGlobalThreadExecutor

+ 22 - 0
liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/resources/chainThreadPool/flow.el.xml

@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<flow>
+    <chain name="chain1"
+           thread-pool-executor-class="com.yomahub.liteflow.test.chainThreadPool.CustomChainThreadExecutor">
+        WHEN(a,b);
+    </chain>
+
+    <chain name="chain2"
+           thread-pool-executor-class="com.yomahub.liteflow.test.chainThreadPool.CustomChainThreadExecutor">
+        FOR(5).parallel(true).DO(THEN(a,f));
+    </chain>
+
+    <chain name="chain3"
+           thread-pool-executor-class="com.yomahub.liteflow.test.chainThreadPool.CustomChainThreadExecutor">
+        WHILE(z).parallel(true).DO(THEN(w,d));
+    </chain>
+
+    <chain name="chain4"
+           thread-pool-executor-class="com.yomahub.liteflow.test.chainThreadPool.CustomChainThreadExecutor">
+        ITERATOR(it).parallel(true).DO(THEN(a,i));
+    </chain>
+</flow>

+ 22 - 0
liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/resources/chainThreadPool/flow2.el.xml

@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<flow>
+    <chain name="chain1"
+           thread-pool-executor-class="com.yomahub.liteflow.test.chainThreadPool.CustomChainThreadExecutor">
+        WHEN(a,b).threadPool("com.yomahub.liteflow.test.chainThreadPool.CustomWhenThreadExecutor");
+    </chain>
+
+    <chain name="chain2"
+           thread-pool-executor-class="com.yomahub.liteflow.test.chainThreadPool.CustomChainThreadExecutor">
+        FOR(5).parallel(true).DO(THEN(a,f)).threadPool("com.yomahub.liteflow.test.chainThreadPool.CustomLoopThreadExecutor");
+    </chain>
+
+    <chain name="chain3"
+           thread-pool-executor-class="com.yomahub.liteflow.test.chainThreadPool.CustomChainThreadExecutor">
+        WHILE(z).parallel(true).DO(THEN(w,d)).threadPool("com.yomahub.liteflow.test.chainThreadPool.CustomLoopThreadExecutor");
+    </chain>
+
+    <chain name="chain4"
+           thread-pool-executor-class="com.yomahub.liteflow.test.chainThreadPool.CustomChainThreadExecutor">
+        ITERATOR(it).parallel(true).DO(THEN(a,i)).threadPool("com.yomahub.liteflow.test.chainThreadPool.CustomLoopThreadExecutor");
+    </chain>
+</flow>

+ 19 - 0
liteflow-testcase-el/liteflow-testcase-el-declare-springboot/src/test/resources/chainThreadPool/flow3.el.xml

@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<flow>
+    <chain name="chain1">
+        WHEN(a,b);
+    </chain>
+
+    <chain name="chain2">
+        FOR(5).parallel(true).DO(THEN(a,f)
+        );
+    </chain>
+
+    <chain name="chain3">
+        WHILE(z).parallel(true).DO(THEN(w,d));
+    </chain>
+
+    <chain name="chain4">
+        ITERATOR(it).parallel(true).DO(THEN(a,i));
+    </chain>
+</flow>

+ 76 - 0
liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/chainThreadPool/ChainThreadPoolELSpringbootTest.java

@@ -0,0 +1,76 @@
+package com.yomahub.liteflow.test.chainThreadPool;
+
+import cn.hutool.core.collection.ListUtil;
+import com.yomahub.liteflow.core.FlowExecutor;
+import com.yomahub.liteflow.core.FlowExecutorHolder;
+import com.yomahub.liteflow.flow.LiteflowResponse;
+import com.yomahub.liteflow.property.LiteflowConfig;
+import com.yomahub.liteflow.slot.DefaultContext;
+import com.yomahub.liteflow.test.BaseTest;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+
+import java.util.List;
+
+/**
+ * springboot环境下chain线程池隔离测试
+ */
+
+public class ChainThreadPoolELSpringbootTest extends BaseTest {
+
+    private static FlowExecutor flowExecutor;
+
+    @BeforeAll
+    public static void init() {
+        LiteflowConfig config = new LiteflowConfig();
+        config.setRuleSource("chainThreadPool/flow.el.xml");
+        flowExecutor = FlowExecutorHolder.loadInstance(config);
+    }
+
+    /**
+     * 测试WHEN上全局线程池和chain线程池隔离-优先以chain上为准
+     */
+    @Test
+    public void testChainThreadPool() {
+        LiteflowResponse response1 = flowExecutor.execute2Resp("chain1", "arg");
+        DefaultContext context = response1.getFirstContextBean();
+        Assertions.assertTrue(response1.isSuccess());
+        Assertions.assertTrue(context.getData("threadName").toString().startsWith("customer-chain-thead"));
+    }
+
+    /**
+     * 测试FOR上全局线程池和chain线程池隔离-优先以chain上为准
+     */
+    @Test
+    public void testChainThreadPool2() {
+        LiteflowResponse response1 = flowExecutor.execute2Resp("chain2", "arg");
+        DefaultContext context = response1.getFirstContextBean();
+        Assertions.assertTrue(response1.isSuccess());
+        Assertions.assertTrue(context.getData("threadName").toString().startsWith("customer-chain-thead"));
+    }
+
+    /**
+     * 测试WHILE上全局线程池和chain线程池隔离-优先以chain上为准
+     */
+    @Test
+    public void testChainThreadPool3() {
+        LiteflowResponse response1 = flowExecutor.execute2Resp("chain3", "arg");
+        DefaultContext context = response1.getFirstContextBean();
+        Assertions.assertTrue(response1.isSuccess());
+        Assertions.assertTrue(context.getData("threadName").toString().startsWith("customer-chain-thead"));
+    }
+
+    /**
+     * 测试ITERATOR上全局线程池和chain线程池隔离-优先以chain上为准
+     */
+    @Test
+    public void testChainThreadPool4() {
+        List<String> list = ListUtil.toList("1", "2", "3", "4", "5");
+        LiteflowResponse response1 = flowExecutor.execute2Resp("chain4", list);
+        DefaultContext context = response1.getFirstContextBean();
+        Assertions.assertTrue(response1.isSuccess());
+        Assertions.assertTrue(context.getData("threadName").toString().startsWith("customer-chain-thead"));
+    }
+
+}

+ 76 - 0
liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/chainThreadPool/ConditionThreadPoolELSpringbootTest.java

@@ -0,0 +1,76 @@
+package com.yomahub.liteflow.test.chainThreadPool;
+
+import cn.hutool.core.collection.ListUtil;
+import com.yomahub.liteflow.core.FlowExecutor;
+import com.yomahub.liteflow.core.FlowExecutorHolder;
+import com.yomahub.liteflow.flow.LiteflowResponse;
+import com.yomahub.liteflow.property.LiteflowConfig;
+import com.yomahub.liteflow.slot.DefaultContext;
+import com.yomahub.liteflow.test.BaseTest;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+
+import java.util.List;
+
+/**
+ * springboot环境下chain线程池隔离测试
+ */
+public class ConditionThreadPoolELSpringbootTest extends BaseTest {
+
+    private static FlowExecutor flowExecutor;
+
+    @BeforeAll
+    public static void init() {
+        LiteflowConfig config = new LiteflowConfig();
+        config.setRuleSource("chainThreadPool/flow2.el.xml");
+        config.setWhenThreadPoolIsolate(true);
+        flowExecutor = FlowExecutorHolder.loadInstance(config);
+    }
+
+    /**
+     * 测试WEHN上condition线程池和chain线程池隔离-优先以WHEN上为准
+     */
+    @Test
+    public void testConditionThreadPool() {
+        LiteflowResponse response1 = flowExecutor.execute2Resp("chain1", "arg");
+        DefaultContext context = response1.getFirstContextBean();
+        Assertions.assertTrue(response1.isSuccess());
+        Assertions.assertTrue(context.getData("threadName").toString().startsWith("customer-when-thead"));
+    }
+
+    /**
+     * 测试FOR上condition线程池和chain线程池隔离-优先以FOR上为准
+     */
+    @Test
+    public void testConditionThreadPool2() {
+        LiteflowResponse response1 = flowExecutor.execute2Resp("chain2", "arg");
+        DefaultContext context = response1.getFirstContextBean();
+        Assertions.assertTrue(response1.isSuccess());
+        Assertions.assertTrue(context.getData("threadName").toString().startsWith("customer-loop-thead"));
+    }
+
+    /**
+     * 测试WHILE上condition线程池和chain线程池隔离-优先以WHILE上为准
+     */
+    @Test
+    public void testConditionThreadPool3() {
+        LiteflowResponse response1 = flowExecutor.execute2Resp("chain3", "arg");
+        DefaultContext context = response1.getFirstContextBean();
+        Assertions.assertTrue(response1.isSuccess());
+        Assertions.assertTrue(context.getData("threadName").toString().startsWith("customer-loop-thead"));
+    }
+
+    /**
+     * 测试ITERATOR上condition线程池和chain线程池隔离-优先以ITERATOR上为准
+     */
+    @Test
+    public void testConditionThreadPool4() {
+        List<String> list = ListUtil.toList("1", "2", "3", "4", "5");
+        LiteflowResponse response1 = flowExecutor.execute2Resp("chain4", list);
+        DefaultContext context = response1.getFirstContextBean();
+        Assertions.assertTrue(response1.isSuccess());
+        Assertions.assertTrue(context.getData("threadName").toString().startsWith("customer-loop-thead"));
+    }
+
+}

+ 23 - 0
liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/chainThreadPool/CustomChainThreadExecutor.java

@@ -0,0 +1,23 @@
+package com.yomahub.liteflow.test.chainThreadPool;
+
+import cn.hutool.core.util.ObjectUtil;
+import com.yomahub.liteflow.property.LiteflowConfig;
+import com.yomahub.liteflow.property.LiteflowConfigGetter;
+import com.yomahub.liteflow.thread.ExecutorBuilder;
+
+import java.util.concurrent.ExecutorService;
+
+public class CustomChainThreadExecutor implements ExecutorBuilder {
+
+    @Override
+    public ExecutorService buildExecutor() {
+        LiteflowConfig liteflowConfig = LiteflowConfigGetter.get();
+        // 只有在非spring的场景下liteflowConfig才会为null
+        if (ObjectUtil.isNull(liteflowConfig)) {
+            liteflowConfig = new LiteflowConfig();
+        }
+        return buildDefaultExecutor(16, 16,
+                                    512, "customer-chain-thead");
+    }
+
+}

+ 23 - 0
liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/chainThreadPool/CustomGlobalThreadExecutor.java

@@ -0,0 +1,23 @@
+package com.yomahub.liteflow.test.chainThreadPool;
+
+import cn.hutool.core.util.ObjectUtil;
+import com.yomahub.liteflow.property.LiteflowConfig;
+import com.yomahub.liteflow.property.LiteflowConfigGetter;
+import com.yomahub.liteflow.thread.ExecutorBuilder;
+
+import java.util.concurrent.ExecutorService;
+
+public class CustomGlobalThreadExecutor implements ExecutorBuilder {
+
+    @Override
+    public ExecutorService buildExecutor() {
+        LiteflowConfig liteflowConfig = LiteflowConfigGetter.get();
+        // 只有在非spring的场景下liteflowConfig才会为null
+        if (ObjectUtil.isNull(liteflowConfig)) {
+            liteflowConfig = new LiteflowConfig();
+        }
+        return buildDefaultExecutor(16, 16,
+                                    512, "customer-global-thead");
+    }
+
+}

+ 23 - 0
liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/chainThreadPool/CustomLoopThreadExecutor.java

@@ -0,0 +1,23 @@
+package com.yomahub.liteflow.test.chainThreadPool;
+
+import cn.hutool.core.util.ObjectUtil;
+import com.yomahub.liteflow.property.LiteflowConfig;
+import com.yomahub.liteflow.property.LiteflowConfigGetter;
+import com.yomahub.liteflow.thread.ExecutorBuilder;
+
+import java.util.concurrent.ExecutorService;
+
+public class CustomLoopThreadExecutor implements ExecutorBuilder {
+
+    @Override
+    public ExecutorService buildExecutor() {
+        LiteflowConfig liteflowConfig = LiteflowConfigGetter.get();
+        // 只有在非spring的场景下liteflowConfig才会为null
+        if (ObjectUtil.isNull(liteflowConfig)) {
+            liteflowConfig = new LiteflowConfig();
+        }
+        return buildDefaultExecutor(16, 16,
+                                    512, "customer-loop-thead");
+    }
+
+}

+ 23 - 0
liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/chainThreadPool/CustomWhenThreadExecutor.java

@@ -0,0 +1,23 @@
+package com.yomahub.liteflow.test.chainThreadPool;
+
+import cn.hutool.core.util.ObjectUtil;
+import com.yomahub.liteflow.property.LiteflowConfig;
+import com.yomahub.liteflow.property.LiteflowConfigGetter;
+import com.yomahub.liteflow.thread.ExecutorBuilder;
+
+import java.util.concurrent.ExecutorService;
+
+public class CustomWhenThreadExecutor implements ExecutorBuilder {
+
+    @Override
+    public ExecutorService buildExecutor() {
+        LiteflowConfig liteflowConfig = LiteflowConfigGetter.get();
+        // 只有在非spring的场景下liteflowConfig才会为null
+        if (ObjectUtil.isNull(liteflowConfig)) {
+            liteflowConfig = new LiteflowConfig();
+        }
+        return buildDefaultExecutor(16, 16,
+                                    512, "customer-when-thead");
+    }
+
+}

+ 80 - 0
liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/chainThreadPool/GlobalThreadPoolELSpringbootTest.java

@@ -0,0 +1,80 @@
+package com.yomahub.liteflow.test.chainThreadPool;
+
+import cn.hutool.core.collection.ListUtil;
+import com.yomahub.liteflow.core.FlowExecutor;
+import com.yomahub.liteflow.core.FlowExecutorHolder;
+import com.yomahub.liteflow.flow.LiteflowResponse;
+import com.yomahub.liteflow.property.LiteflowConfig;
+import com.yomahub.liteflow.slot.DefaultContext;
+import com.yomahub.liteflow.test.BaseTest;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+
+import java.util.List;
+
+/**
+ * springboot环境下Global线程池隔离测试
+ */
+
+public class GlobalThreadPoolELSpringbootTest extends BaseTest {
+
+
+    private static FlowExecutor flowExecutor;
+
+    @BeforeAll
+    public static void init() {
+        LiteflowConfig config = new LiteflowConfig();
+        config.setRuleSource("chainThreadPool/flow3.el.xml");
+        config.setGlobalThreadPoolSize(10);
+        config.setGlobalThreadPoolQueueSize(1024);
+        config.setGlobalThreadPoolExecutorClass("com.yomahub.liteflow.test.chainThreadPool.CustomGlobalThreadExecutor");
+        flowExecutor = FlowExecutorHolder.loadInstance(config);
+    }
+
+    /**
+     * 测试WHEN上全局线程池
+     */
+    @Test
+    public void testGlobalThreadPool() {
+        LiteflowResponse response1 = flowExecutor.execute2Resp("chain1", "arg");
+        DefaultContext context = response1.getFirstContextBean();
+        Assertions.assertTrue(response1.isSuccess());
+        Assertions.assertTrue(context.getData("threadName").toString().startsWith("customer-global-thead"));
+    }
+
+    /**
+     * 测试FOR上全局线程池
+     */
+    @Test
+    public void testGlobalThreadPool2() {
+        LiteflowResponse response1 = flowExecutor.execute2Resp("chain2", "arg");
+        DefaultContext context = response1.getFirstContextBean();
+        Assertions.assertTrue(response1.isSuccess());
+        Assertions.assertTrue(context.getData("threadName").toString().startsWith("customer-global-thead"));
+    }
+
+    /**
+     * 测试WHILE上全局线程池
+     */
+    @Test
+    public void testGlobalThreadPool3() {
+        LiteflowResponse response1 = flowExecutor.execute2Resp("chain3", "arg");
+        DefaultContext context = response1.getFirstContextBean();
+        Assertions.assertTrue(response1.isSuccess());
+        Assertions.assertTrue(context.getData("threadName").toString().startsWith("customer-global-thead"));
+    }
+
+    /**
+     * 测试ITERATOR上全局线程池
+     */
+    @Test
+    public void testGlobalThreadPool4() {
+        List<String> list = ListUtil.toList("1", "2", "3", "4", "5");
+        LiteflowResponse response1 = flowExecutor.execute2Resp("chain4", list);
+        DefaultContext context = response1.getFirstContextBean();
+        Assertions.assertTrue(response1.isSuccess());
+        Assertions.assertTrue(context.getData("threadName").toString().startsWith("customer-global-thead"));
+    }
+
+}

+ 21 - 0
liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/chainThreadPool/cmp/ACmp.java

@@ -0,0 +1,21 @@
+/**
+ * <p>Title: liteflow</p>
+ * <p>Description: 轻量级的组件式流程框架</p>
+ *
+ * @author Bryan.Zhang
+ * @email weenyc31@163.com
+ * @Date 2020/4/1
+ */
+package com.yomahub.liteflow.test.chainThreadPool.cmp;
+
+import com.yomahub.liteflow.core.NodeComponent;
+
+
+public class ACmp extends NodeComponent {
+
+    @Override
+    public void process() {
+        System.out.println("ACmp executed!");
+    }
+
+}

+ 23 - 0
liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/chainThreadPool/cmp/BCmp.java

@@ -0,0 +1,23 @@
+/**
+ * <p>Title: liteflow</p>
+ * <p>Description: 轻量级的组件式流程框架</p>
+ *
+ * @author Bryan.Zhang
+ * @email weenyc31@163.com
+ * @Date 2020/4/1
+ */
+package com.yomahub.liteflow.test.chainThreadPool.cmp;
+
+import com.yomahub.liteflow.core.NodeComponent;
+import com.yomahub.liteflow.slot.DefaultContext;
+
+public class BCmp extends NodeComponent {
+
+    @Override
+    public void process() {
+        DefaultContext context = this.getFirstContextBean();
+        context.setData("threadName", Thread.currentThread().getName());
+        System.out.println("BCmp executed!");
+    }
+
+}

+ 28 - 0
liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/chainThreadPool/cmp/DCmp.java

@@ -0,0 +1,28 @@
+/**
+ * <p>Title: liteflow</p>
+ * <p>Description: 轻量级的组件式流程框架</p>
+ *
+ * @author Bryan.Zhang
+ * @email weenyc31@163.com
+ * @Date 2020/4/1
+ */
+package com.yomahub.liteflow.test.chainThreadPool.cmp;
+
+import com.yomahub.liteflow.core.NodeComponent;
+import com.yomahub.liteflow.slot.DefaultContext;
+
+public class DCmp extends NodeComponent {
+
+	@Override
+	public void process() {
+		DefaultContext context = this.getFirstContextBean();
+		String key = "test";
+		if (context.hasData(key)) {
+			int count = context.getData(key);
+			context.setData(key, ++count);
+		} else {
+			context.setData(key, 1);
+		}
+	}
+
+}

+ 24 - 0
liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/chainThreadPool/cmp/FCmp.java

@@ -0,0 +1,24 @@
+/**
+ * <p>Title: liteflow</p>
+ * <p>Description: 轻量级的组件式流程框架</p>
+ *
+ * @author Bryan.Zhang
+ * @email weenyc31@163.com
+ * @Date 2020/4/1
+ */
+package com.yomahub.liteflow.test.chainThreadPool.cmp;
+
+import com.yomahub.liteflow.core.NodeComponent;
+import com.yomahub.liteflow.slot.DefaultContext;
+
+
+public class FCmp extends NodeComponent {
+
+    @Override
+    public void process() {
+        DefaultContext context = this.getFirstContextBean();
+        context.setData("threadName", Thread.currentThread().getName());
+        System.out.println("FCmp executed!");
+    }
+
+}

+ 23 - 0
liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/chainThreadPool/cmp/ICmp.java

@@ -0,0 +1,23 @@
+/**
+ * <p>Title: liteflow</p>
+ * <p>Description: 轻量级的组件式流程框架</p>
+ *
+ * @author Bryan.Zhang
+ * @email weenyc31@163.com
+ * @Date 2020/4/1
+ */
+package com.yomahub.liteflow.test.chainThreadPool.cmp;
+
+import com.yomahub.liteflow.core.NodeComponent;
+import com.yomahub.liteflow.slot.DefaultContext;
+
+public class ICmp extends NodeComponent {
+
+    @Override
+    public void process() {
+        DefaultContext context = this.getFirstContextBean();
+        context.setData("threadName", Thread.currentThread().getName());
+        System.out.println("ICmp executed!");
+    }
+
+}

+ 15 - 0
liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/chainThreadPool/cmp/ITCmp.java

@@ -0,0 +1,15 @@
+package com.yomahub.liteflow.test.chainThreadPool.cmp;
+
+import com.yomahub.liteflow.core.NodeIteratorComponent;
+
+import java.util.Iterator;
+import java.util.List;
+
+public class ITCmp extends NodeIteratorComponent {
+
+    @Override
+    public Iterator<?> processIterator() throws Exception {
+        List<String> list = this.getRequestData();
+        return list.iterator();
+    }
+}

+ 23 - 0
liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/chainThreadPool/cmp/WCmp.java

@@ -0,0 +1,23 @@
+/**
+ * <p>Title: liteflow</p>
+ * <p>Description: 轻量级的组件式流程框架</p>
+ *
+ * @author Bryan.Zhang
+ * @email weenyc31@163.com
+ * @Date 2020/4/1
+ */
+package com.yomahub.liteflow.test.chainThreadPool.cmp;
+
+import com.yomahub.liteflow.core.NodeComponent;
+import com.yomahub.liteflow.slot.DefaultContext;
+
+public class WCmp extends NodeComponent {
+
+    @Override
+    public void process() {
+        DefaultContext context = this.getFirstContextBean();
+        context.setData("threadName", Thread.currentThread().getName());
+        System.out.println("WCmp executed!");
+    }
+
+}

+ 20 - 0
liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/chainThreadPool/cmp/ZCmp.java

@@ -0,0 +1,20 @@
+package com.yomahub.liteflow.test.chainThreadPool.cmp;
+
+import com.yomahub.liteflow.core.NodeBooleanComponent;
+import com.yomahub.liteflow.slot.DefaultContext;
+
+
+public class ZCmp extends NodeBooleanComponent {
+
+    @Override
+    public boolean processBoolean() throws Exception {
+        DefaultContext context = this.getFirstContextBean();
+        String key = "test";
+        if (context.hasData(key)) {
+            int count = context.getData("test");
+            return count < 5;
+        } else {
+            return true;
+        }
+    }
+}

+ 2 - 2
liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/config/LiteflowConfigTest1.java

@@ -42,8 +42,8 @@ public class LiteflowConfigTest1 extends BaseTest {
 		Assertions.assertEquals(300000L, config.getDelay().longValue());
 		Assertions.assertEquals(300000L, config.getDelay().longValue());
 		Assertions.assertEquals(300000L, config.getPeriod().longValue());
 		Assertions.assertEquals(300000L, config.getPeriod().longValue());
 		Assertions.assertFalse(config.getEnableLog());
 		Assertions.assertFalse(config.getEnableLog());
-		Assertions.assertEquals(16, config.getWhenMaxWorkers().longValue());
-		Assertions.assertEquals(512, config.getWhenQueueLimit().longValue());
+        Assertions.assertEquals(16, config.getGlobalThreadPoolSize().longValue());
+        Assertions.assertEquals(512, config.getGlobalThreadPoolQueueSize().longValue());
 		Assertions.assertEquals(ParseModeEnum.PARSE_ALL_ON_START, config.getParseMode());
 		Assertions.assertEquals(ParseModeEnum.PARSE_ALL_ON_START, config.getParseMode());
 	}
 	}
 
 

+ 2 - 2
liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/customWhenThreadPool/CustomThreadExecutor1.java

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

+ 2 - 2
liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/customWhenThreadPool/CustomThreadExecutor2.java

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

+ 2 - 2
liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/customWhenThreadPool/CustomThreadExecutor3.java

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

+ 1 - 1
liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/customWhenThreadPool/CustomWhenThreadPoolTest.java

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

+ 2 - 2
liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/parallelLoop/CustomThreadExecutor.java

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

+ 3 - 4
liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/java/com/yomahub/liteflow/test/parallelLoop/ParallelLoopTest.java

@@ -12,7 +12,6 @@ import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.BeforeAll;
 import org.junit.jupiter.api.BeforeAll;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.Test;
 
 
-
 import java.util.List;
 import java.util.List;
 import java.util.regex.Pattern;
 import java.util.regex.Pattern;
 
 
@@ -31,9 +30,9 @@ public class ParallelLoopTest extends BaseTest {
 	public static void init() {
 	public static void init() {
 		LiteflowConfig config = new LiteflowConfig();
 		LiteflowConfig config = new LiteflowConfig();
 		config.setRuleSource("parallelLoop/flow.xml");
 		config.setRuleSource("parallelLoop/flow.xml");
-		config.setParallelMaxWorkers(10);
-		config.setParallelQueueLimit(1024);
-		config.setParallelLoopExecutorClass("com.yomahub.liteflow.test.parallelLoop.CustomThreadExecutor");
+        config.setGlobalThreadPoolSize(10);
+        config.setGlobalThreadPoolQueueSize(1024);
+        config.setGlobalThreadPoolExecutorClass("com.yomahub.liteflow.test.parallelLoop.CustomThreadExecutor");
 		flowExecutor = FlowExecutorHolder.loadInstance(config);
 		flowExecutor = FlowExecutorHolder.loadInstance(config);
 	}
 	}
 
 

+ 1 - 0
liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/resources/chainThreadPool/application.properties

@@ -0,0 +1 @@
+liteflow.rule-source=chainThreadPool/flow.el.xml

+ 2 - 0
liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/resources/chainThreadPool/application2.properties

@@ -0,0 +1,2 @@
+liteflow.rule-source=chainThreadPool/flow2.el.xml
+liteflow.when-thread-pool-isolate=true

+ 4 - 0
liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/resources/chainThreadPool/application3.properties

@@ -0,0 +1,4 @@
+liteflow.rule-source=chainThreadPool/flow3.el.xml
+liteflow.global-thread-pool-size=16
+liteflow.global-thread-pool-queue-size=512
+liteflow.global-thread-pool-executor-class=com.yomahub.liteflow.test.chainThreadPool.CustomGlobalThreadExecutor

+ 33 - 0
liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/resources/chainThreadPool/flow.el.xml

@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<flow>
+    <nodes>
+        <node id="a" class="com.yomahub.liteflow.test.chainThreadPool.cmp.ACmp"/>
+        <node id="b" class="com.yomahub.liteflow.test.chainThreadPool.cmp.BCmp"/>
+        <node id="d" class="com.yomahub.liteflow.test.chainThreadPool.cmp.DCmp"/>
+        <node id="f" class="com.yomahub.liteflow.test.chainThreadPool.cmp.FCmp"/>
+        <node id="i" class="com.yomahub.liteflow.test.chainThreadPool.cmp.ICmp"/>
+        <node id="it" class="com.yomahub.liteflow.test.chainThreadPool.cmp.ITCmp"/>
+        <node id="w" class="com.yomahub.liteflow.test.chainThreadPool.cmp.WCmp"/>
+        <node id="z" class="com.yomahub.liteflow.test.chainThreadPool.cmp.ZCmp"/>
+    </nodes>
+
+    <chain name="chain1"
+           thread-pool-executor-class="com.yomahub.liteflow.test.chainThreadPool.CustomChainThreadExecutor">
+        WHEN(a,b);
+    </chain>
+
+    <chain name="chain2"
+           thread-pool-executor-class="com.yomahub.liteflow.test.chainThreadPool.CustomChainThreadExecutor">
+        FOR(5).parallel(true).DO(THEN(a,f));
+    </chain>
+
+    <chain name="chain3"
+           thread-pool-executor-class="com.yomahub.liteflow.test.chainThreadPool.CustomChainThreadExecutor">
+        WHILE(z).parallel(true).DO(THEN(w,d));
+    </chain>
+
+    <chain name="chain4"
+           thread-pool-executor-class="com.yomahub.liteflow.test.chainThreadPool.CustomChainThreadExecutor">
+        ITERATOR(it).parallel(true).DO(THEN(a,i));
+    </chain>
+</flow>

+ 32 - 0
liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/resources/chainThreadPool/flow2.el.xml

@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<flow>
+    <nodes>
+        <node id="a" class="com.yomahub.liteflow.test.chainThreadPool.cmp.ACmp"/>
+        <node id="b" class="com.yomahub.liteflow.test.chainThreadPool.cmp.BCmp"/>
+        <node id="d" class="com.yomahub.liteflow.test.chainThreadPool.cmp.DCmp"/>
+        <node id="f" class="com.yomahub.liteflow.test.chainThreadPool.cmp.FCmp"/>
+        <node id="i" class="com.yomahub.liteflow.test.chainThreadPool.cmp.ICmp"/>
+        <node id="it" class="com.yomahub.liteflow.test.chainThreadPool.cmp.ITCmp"/>
+        <node id="w" class="com.yomahub.liteflow.test.chainThreadPool.cmp.WCmp"/>
+        <node id="z" class="com.yomahub.liteflow.test.chainThreadPool.cmp.ZCmp"/>
+    </nodes>
+    <chain name="chain1"
+           thread-pool-executor-class="com.yomahub.liteflow.test.chainThreadPool.CustomChainThreadExecutor">
+        WHEN(a,b).threadPool("com.yomahub.liteflow.test.chainThreadPool.CustomWhenThreadExecutor");
+    </chain>
+
+    <chain name="chain2"
+           thread-pool-executor-class="com.yomahub.liteflow.test.chainThreadPool.CustomChainThreadExecutor">
+        FOR(5).parallel(true).DO(THEN(a,f)).threadPool("com.yomahub.liteflow.test.chainThreadPool.CustomLoopThreadExecutor");
+    </chain>
+
+    <chain name="chain3"
+           thread-pool-executor-class="com.yomahub.liteflow.test.chainThreadPool.CustomChainThreadExecutor">
+        WHILE(z).parallel(true).DO(THEN(w,d)).threadPool("com.yomahub.liteflow.test.chainThreadPool.CustomLoopThreadExecutor");
+    </chain>
+
+    <chain name="chain4"
+           thread-pool-executor-class="com.yomahub.liteflow.test.chainThreadPool.CustomChainThreadExecutor">
+        ITERATOR(it).parallel(true).DO(THEN(a,i)).threadPool("com.yomahub.liteflow.test.chainThreadPool.CustomLoopThreadExecutor");
+    </chain>
+</flow>

+ 29 - 0
liteflow-testcase-el/liteflow-testcase-el-nospring/src/test/resources/chainThreadPool/flow3.el.xml

@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<flow>
+    <nodes>
+        <node id="a" class="com.yomahub.liteflow.test.chainThreadPool.cmp.ACmp"/>
+        <node id="b" class="com.yomahub.liteflow.test.chainThreadPool.cmp.BCmp"/>
+        <node id="d" class="com.yomahub.liteflow.test.chainThreadPool.cmp.DCmp"/>
+        <node id="f" class="com.yomahub.liteflow.test.chainThreadPool.cmp.FCmp"/>
+        <node id="i" class="com.yomahub.liteflow.test.chainThreadPool.cmp.ICmp"/>
+        <node id="it" class="com.yomahub.liteflow.test.chainThreadPool.cmp.ITCmp"/>
+        <node id="w" class="com.yomahub.liteflow.test.chainThreadPool.cmp.WCmp"/>
+        <node id="z" class="com.yomahub.liteflow.test.chainThreadPool.cmp.ZCmp"/>
+    </nodes>
+    <chain name="chain1">
+        WHEN(a,b);
+    </chain>
+
+    <chain name="chain2">
+        FOR(5).parallel(true).DO(THEN(a,f)
+        );
+    </chain>
+
+    <chain name="chain3">
+        WHILE(z).parallel(true).DO(THEN(w,d));
+    </chain>
+
+    <chain name="chain4">
+        ITERATOR(it).parallel(true).DO(THEN(a,i));
+    </chain>
+</flow>

+ 4 - 0
liteflow-testcase-el/liteflow-testcase-el-solon/pom.xml

@@ -66,5 +66,9 @@
             <artifactId>logback-classic</artifactId>
             <artifactId>logback-classic</artifactId>
             <version>1.2.11</version>
             <version>1.2.11</version>
         </dependency>
         </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-test</artifactId>
+        </dependency>
     </dependencies>
     </dependencies>
 </project>
 </project>

+ 72 - 0
liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/chainThreadPool/ChainThreadPoolELSpringbootTest.java

@@ -0,0 +1,72 @@
+package com.yomahub.liteflow.test.chainThreadPool;
+
+import cn.hutool.core.collection.ListUtil;
+import com.yomahub.liteflow.core.FlowExecutor;
+import com.yomahub.liteflow.flow.LiteflowResponse;
+import com.yomahub.liteflow.slot.DefaultContext;
+import com.yomahub.liteflow.test.BaseTest;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+import org.noear.solon.annotation.Import;
+import org.noear.solon.annotation.Inject;
+import org.noear.solon.test.SolonTest;
+
+import java.util.List;
+
+/**
+ * springboot环境下chain线程池隔离测试
+ */
+@SolonTest
+@Import(profiles = "classpath:/chainThreadPool/application.properties")
+public class ChainThreadPoolELSpringbootTest extends BaseTest {
+
+
+    @Inject
+    private FlowExecutor flowExecutor;
+
+    /**
+     * 测试WHEN上全局线程池和chain线程池隔离-优先以chain上为准
+     */
+    @Test
+    public void testChainThreadPool() {
+        LiteflowResponse response1 = flowExecutor.execute2Resp("chain1", "arg");
+        DefaultContext context = response1.getFirstContextBean();
+        Assertions.assertTrue(response1.isSuccess());
+        Assertions.assertTrue(context.getData("threadName").toString().startsWith("customer-chain-thead"));
+    }
+
+    /**
+     * 测试FOR上全局线程池和chain线程池隔离-优先以chain上为准
+     */
+    @Test
+    public void testChainThreadPool2() {
+        LiteflowResponse response1 = flowExecutor.execute2Resp("chain2", "arg");
+        DefaultContext context = response1.getFirstContextBean();
+        Assertions.assertTrue(response1.isSuccess());
+        Assertions.assertTrue(context.getData("threadName").toString().startsWith("customer-chain-thead"));
+    }
+
+    /**
+     * 测试WHILE上全局线程池和chain线程池隔离-优先以chain上为准
+     */
+    @Test
+    public void testChainThreadPool3() {
+        LiteflowResponse response1 = flowExecutor.execute2Resp("chain3", "arg");
+        DefaultContext context = response1.getFirstContextBean();
+        Assertions.assertTrue(response1.isSuccess());
+        Assertions.assertTrue(context.getData("threadName").toString().startsWith("customer-chain-thead"));
+    }
+
+    /**
+     * 测试ITERATOR上全局线程池和chain线程池隔离-优先以chain上为准
+     */
+    @Test
+    public void testChainThreadPool4() {
+        List<String> list = ListUtil.toList("1", "2", "3", "4", "5");
+        LiteflowResponse response1 = flowExecutor.execute2Resp("chain4", list);
+        DefaultContext context = response1.getFirstContextBean();
+        Assertions.assertTrue(response1.isSuccess());
+        Assertions.assertTrue(context.getData("threadName").toString().startsWith("customer-chain-thead"));
+    }
+
+}

+ 73 - 0
liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/chainThreadPool/ConditionThreadPoolELSpringbootTest.java

@@ -0,0 +1,73 @@
+package com.yomahub.liteflow.test.chainThreadPool;
+
+import cn.hutool.core.collection.ListUtil;
+import com.yomahub.liteflow.core.FlowExecutor;
+import com.yomahub.liteflow.flow.LiteflowResponse;
+import com.yomahub.liteflow.slot.DefaultContext;
+import com.yomahub.liteflow.test.BaseTest;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+import org.noear.solon.annotation.Import;
+import org.noear.solon.annotation.Inject;
+import org.noear.solon.test.SolonTest;
+
+import java.util.List;
+
+/**
+ * springboot环境下chain线程池隔离测试
+ */
+
+@SolonTest
+@Import(profiles = "classpath:/chainThreadPool/application2.properties")
+public class ConditionThreadPoolELSpringbootTest extends BaseTest {
+
+
+    @Inject
+    private FlowExecutor flowExecutor;
+
+    /**
+     * 测试WEHN上condition线程池和chain线程池隔离-优先以WHEN上为准
+     */
+    @Test
+    public void testConditionThreadPool() {
+        LiteflowResponse response1 = flowExecutor.execute2Resp("chain1", "arg");
+        DefaultContext context = response1.getFirstContextBean();
+        Assertions.assertTrue(response1.isSuccess());
+        Assertions.assertTrue(context.getData("threadName").toString().startsWith("customer-when-thead"));
+    }
+
+    /**
+     * 测试FOR上condition线程池和chain线程池隔离-优先以FOR上为准
+     */
+    @Test
+    public void testConditionThreadPool2() {
+        LiteflowResponse response1 = flowExecutor.execute2Resp("chain2", "arg");
+        DefaultContext context = response1.getFirstContextBean();
+        Assertions.assertTrue(response1.isSuccess());
+        Assertions.assertTrue(context.getData("threadName").toString().startsWith("customer-loop-thead"));
+    }
+
+    /**
+     * 测试WHILE上condition线程池和chain线程池隔离-优先以WHILE上为准
+     */
+    @Test
+    public void testConditionThreadPool3() {
+        LiteflowResponse response1 = flowExecutor.execute2Resp("chain3", "arg");
+        DefaultContext context = response1.getFirstContextBean();
+        Assertions.assertTrue(response1.isSuccess());
+        Assertions.assertTrue(context.getData("threadName").toString().startsWith("customer-loop-thead"));
+    }
+
+    /**
+     * 测试ITERATOR上condition线程池和chain线程池隔离-优先以ITERATOR上为准
+     */
+    @Test
+    public void testConditionThreadPool4() {
+        List<String> list = ListUtil.toList("1", "2", "3", "4", "5");
+        LiteflowResponse response1 = flowExecutor.execute2Resp("chain4", list);
+        DefaultContext context = response1.getFirstContextBean();
+        Assertions.assertTrue(response1.isSuccess());
+        Assertions.assertTrue(context.getData("threadName").toString().startsWith("customer-loop-thead"));
+    }
+
+}

+ 23 - 0
liteflow-testcase-el/liteflow-testcase-el-solon/src/test/java/com/yomahub/liteflow/test/chainThreadPool/CustomChainThreadExecutor.java

@@ -0,0 +1,23 @@
+package com.yomahub.liteflow.test.chainThreadPool;
+
+import cn.hutool.core.util.ObjectUtil;
+import com.yomahub.liteflow.property.LiteflowConfig;
+import com.yomahub.liteflow.property.LiteflowConfigGetter;
+import com.yomahub.liteflow.thread.ExecutorBuilder;
+
+import java.util.concurrent.ExecutorService;
+
+public class CustomChainThreadExecutor implements ExecutorBuilder {
+
+    @Override
+    public ExecutorService buildExecutor() {
+        LiteflowConfig liteflowConfig = LiteflowConfigGetter.get();
+        // 只有在非spring的场景下liteflowConfig才会为null
+        if (ObjectUtil.isNull(liteflowConfig)) {
+            liteflowConfig = new LiteflowConfig();
+        }
+        return buildDefaultExecutor(16, 16,
+                                    512, "customer-chain-thead");
+    }
+
+}

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно