diff --git a/liteflow-core/src/main/java/com/yomahub/liteflow/enums/CmpStepTypeEnum.java b/liteflow-core/src/main/java/com/yomahub/liteflow/enums/CmpStepTypeEnum.java index f01a4f18..474ec842 100644 --- a/liteflow-core/src/main/java/com/yomahub/liteflow/enums/CmpStepTypeEnum.java +++ b/liteflow-core/src/main/java/com/yomahub/liteflow/enums/CmpStepTypeEnum.java @@ -1,6 +1,7 @@ /** *
Title: liteflow
*Description: 轻量级的组件式流程框架
+ * * @author Bryan.Zhang * @email weenyc31@163.com * @Date 2020/4/1 @@ -14,6 +15,6 @@ package com.yomahub.liteflow.enums; */ public enum CmpStepTypeEnum { - START, END, SINGLE; + START, END, SINGLE, THEN_START, THEN_END; } diff --git a/liteflow-core/src/main/java/com/yomahub/liteflow/flow/element/condition/WhenCondition.java b/liteflow-core/src/main/java/com/yomahub/liteflow/flow/element/condition/WhenCondition.java index 15eb31cb..3736be2d 100644 --- a/liteflow-core/src/main/java/com/yomahub/liteflow/flow/element/condition/WhenCondition.java +++ b/liteflow-core/src/main/java/com/yomahub/liteflow/flow/element/condition/WhenCondition.java @@ -8,13 +8,17 @@ package com.yomahub.liteflow.flow.element.condition; import com.yomahub.liteflow.common.LocalDefaultFlowConstant; +import com.yomahub.liteflow.enums.CmpStepTypeEnum; import com.yomahub.liteflow.enums.ConditionTypeEnum; import com.yomahub.liteflow.enums.ParallelStrategyEnum; import com.yomahub.liteflow.flow.element.Condition; +import com.yomahub.liteflow.flow.entity.CmpStep; import com.yomahub.liteflow.flow.parallel.strategy.ParallelStrategyExecutor; import com.yomahub.liteflow.flow.parallel.strategy.ParallelStrategyHelper; import com.yomahub.liteflow.log.LFLog; import com.yomahub.liteflow.log.LFLoggerManager; +import com.yomahub.liteflow.slot.DataBus; +import com.yomahub.liteflow.slot.Slot; import com.yomahub.liteflow.thread.ExecutorHelper; import java.util.Set; @@ -64,13 +68,15 @@ public class WhenCondition extends Condition { // 使用线程池执行 when 并发流程 // 这块涉及到挺多的多线程逻辑,所以注释比较详细,看到这里的童鞋可以仔细阅读 private void executeAsyncCondition(Integer slotIndex) throws Exception { - + Slot slot = DataBus.getSlot(slotIndex); + slot.addStep(new CmpStep("-1", "-1", CmpStepTypeEnum.THEN_START)); // 获取并发执行策略 ParallelStrategyExecutor parallelStrategyExecutor = ParallelStrategyHelper.loadInstance().buildParallelExecutor(this.getParallelStrategy()); // 执行并发逻辑 parallelStrategyExecutor.execute(this, slotIndex); + slot.addStep(new CmpStep("-1", "-1", CmpStepTypeEnum.THEN_END)); } public boolean isIgnoreError() { diff --git a/liteflow-core/src/main/java/com/yomahub/liteflow/slot/Slot.java b/liteflow-core/src/main/java/com/yomahub/liteflow/slot/Slot.java index 8bd133c1..f2b73056 100644 --- a/liteflow-core/src/main/java/com/yomahub/liteflow/slot/Slot.java +++ b/liteflow-core/src/main/java/com/yomahub/liteflow/slot/Slot.java @@ -1,6 +1,7 @@ /** *Title: liteflow
*Description: 轻量级的组件式流程框架
+ * * @author Bryan.Zhang * @email weenyc31@163.com * @Date 2020/4/1 @@ -11,6 +12,7 @@ import cn.hutool.core.collection.ConcurrentHashSet; import cn.hutool.core.collection.ListUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; +import com.yomahub.liteflow.enums.CmpStepTypeEnum; import com.yomahub.liteflow.exception.NoSuchContextBeanException; import com.yomahub.liteflow.exception.NullParamException; import com.yomahub.liteflow.flow.element.Condition; @@ -340,6 +342,21 @@ public class Slot { CmpStep cmpStep; for (Iterator