mirror of
https://gitee.com/dromara/liteFlow.git
synced 2026-05-14 12:12:08 +08:00
bug #IC71HA 在线程1的执行过程中线程2去remove chain导致的线程1无法平滑继续执行的bug
This commit is contained in:
@@ -120,8 +120,9 @@ public class Chain implements Executable{
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 设置主ChainName
|
// 设置主ChainId
|
||||||
slot.setChainId(chainId);
|
slot.setChainId(chainId);
|
||||||
|
slot.addChainInstance(this);
|
||||||
// 执行主体Condition
|
// 执行主体Condition
|
||||||
for (Condition condition : conditionList) {
|
for (Condition condition : conditionList) {
|
||||||
condition.setCurrChainId(chainId);
|
condition.setCurrChainId(chainId);
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ public abstract class Condition implements Executable{
|
|||||||
private final Map<String, List<Executable>> executableGroup = new HashMap<>();
|
private final Map<String, List<Executable>> executableGroup = new HashMap<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 当前所在的ChainName 如果对于子流程来说,那这个就是子流程所在的Chain
|
* 当前所在的ChainId 如果对于子流程来说,那这个就是子流程所在的Chain
|
||||||
*/
|
*/
|
||||||
private String currChainId;
|
private String currChainId;
|
||||||
|
|
||||||
|
|||||||
@@ -16,12 +16,12 @@ import cn.hutool.core.util.StrUtil;
|
|||||||
import com.alibaba.ttl.TransmittableThreadLocal;
|
import com.alibaba.ttl.TransmittableThreadLocal;
|
||||||
import com.yomahub.liteflow.exception.NoSuchContextBeanException;
|
import com.yomahub.liteflow.exception.NoSuchContextBeanException;
|
||||||
import com.yomahub.liteflow.exception.NullParamException;
|
import com.yomahub.liteflow.exception.NullParamException;
|
||||||
|
import com.yomahub.liteflow.flow.element.Chain;
|
||||||
import com.yomahub.liteflow.flow.element.Condition;
|
import com.yomahub.liteflow.flow.element.Condition;
|
||||||
import com.yomahub.liteflow.flow.entity.CmpStep;
|
import com.yomahub.liteflow.flow.entity.CmpStep;
|
||||||
import com.yomahub.liteflow.flow.id.IdGeneratorHolder;
|
import com.yomahub.liteflow.flow.id.IdGeneratorHolder;
|
||||||
import com.yomahub.liteflow.log.LFLog;
|
import com.yomahub.liteflow.log.LFLog;
|
||||||
import com.yomahub.liteflow.log.LFLoggerManager;
|
import com.yomahub.liteflow.log.LFLoggerManager;
|
||||||
import com.yomahub.liteflow.property.LiteflowConfigGetter;
|
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
@@ -46,7 +46,9 @@ public class Slot {
|
|||||||
|
|
||||||
private static final String RESPONSE = "_response";
|
private static final String RESPONSE = "_response";
|
||||||
|
|
||||||
private static final String CHAIN_NAME = "_chain_name";
|
private static final String CHAIN_ID = "_chain_id";
|
||||||
|
|
||||||
|
private static final String CHAIN_INSTANCE = "_chain_instance";
|
||||||
|
|
||||||
private static final String SWITCH_NODE_PREFIX = "_switch_";
|
private static final String SWITCH_NODE_PREFIX = "_switch_";
|
||||||
|
|
||||||
@@ -326,13 +328,31 @@ public class Slot {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setChainId(String chainId) {
|
public void setChainId(String chainId) {
|
||||||
if (!hasMetaData(CHAIN_NAME)) {
|
if (!hasMetaData(CHAIN_ID)) {
|
||||||
this.putMetaDataMap(CHAIN_NAME, chainId);
|
this.putMetaDataMap(CHAIN_ID, chainId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getChainId() {
|
public String getChainId() {
|
||||||
return (String) metaDataMap.get(CHAIN_NAME);
|
return (String) metaDataMap.get(CHAIN_ID);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addChainInstance(Chain chain){
|
||||||
|
if (!hasMetaData(CHAIN_INSTANCE)) {
|
||||||
|
this.putMetaDataMap(CHAIN_INSTANCE, ListUtil.toList(chain));
|
||||||
|
}else{
|
||||||
|
List<Chain> list = (List<Chain>) metaDataMap.get(CHAIN_INSTANCE);
|
||||||
|
list.add(chain);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Chain getCurrentChainInstance(String currentChainId){
|
||||||
|
if (hasMetaData(CHAIN_INSTANCE)) {
|
||||||
|
List<Chain> list = (List<Chain>) metaDataMap.get(CHAIN_INSTANCE);
|
||||||
|
return list.stream().filter(chain -> chain.getId().equals(currentChainId)).findFirst().orElse(null);
|
||||||
|
}else{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addStep(CmpStep step) {
|
public void addStep(CmpStep step) {
|
||||||
|
|||||||
@@ -185,8 +185,8 @@ public class ExecutorHelper {
|
|||||||
public ExecutorService buildExecutorService(Condition condition, Integer slotIndex, ConditionTypeEnum type) {
|
public ExecutorService buildExecutorService(Condition condition, Integer slotIndex, ConditionTypeEnum type) {
|
||||||
ExecutorService executor;
|
ExecutorService executor;
|
||||||
LiteflowConfig liteflowConfig = LiteflowConfigGetter.get();
|
LiteflowConfig liteflowConfig = LiteflowConfigGetter.get();
|
||||||
String chainId = DataBus.getSlot(slotIndex).getChainId();
|
String currChainId = condition.getCurrChainId();
|
||||||
Chain chain = FlowBus.getChain(chainId);
|
Chain chain = DataBus.getSlot(slotIndex).getCurrentChainInstance(currChainId);
|
||||||
|
|
||||||
// 构建条件判断对象
|
// 构建条件判断对象
|
||||||
ExecutorCondition execCondition = ExecutorConditionBuilder.buildExecutorCondition(
|
ExecutorCondition execCondition = ExecutorConditionBuilder.buildExecutorCondition(
|
||||||
|
|||||||
2
pom.xml
2
pom.xml
@@ -39,7 +39,7 @@
|
|||||||
</scm>
|
</scm>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<revision>2.13.2</revision>
|
<revision>2.13.2.1</revision>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
<maven.compiler.source>8</maven.compiler.source>
|
<maven.compiler.source>8</maven.compiler.source>
|
||||||
|
|||||||
Reference in New Issue
Block a user