From 82e26527d9f290f95ba7ba2cdab595ddf18a6a30 Mon Sep 17 00:00:00 2001 From: "bryan.zhang" Date: Sun, 29 Mar 2020 17:52:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=9C=A8=E5=A4=9A=E4=B8=AAfl?= =?UTF-8?q?ow.xml=E9=85=8D=E7=BD=AE=E7=9A=84=E6=97=B6=E5=80=99=EF=BC=8C?= =?UTF-8?q?=E6=9D=A1=E4=BB=B6=E8=8A=82=E7=82=B9=E4=BC=9A=E5=87=BA=E9=94=99?= =?UTF-8?q?=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- liteflow-core/pom.xml | 2 +- .../java/com/yomahub/liteflow/flow/FlowBus.java | 14 ++++++-------- .../com/yomahub/liteflow/parser/XmlFlowParser.java | 4 +++- liteflow-spring-boot-starter/pom.xml | 2 +- liteflow-test-spring/pom.xml | 2 +- liteflow-test-springboot/pom.xml | 2 +- pom.xml | 2 +- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/liteflow-core/pom.xml b/liteflow-core/pom.xml index 761528291..0c9d49636 100644 --- a/liteflow-core/pom.xml +++ b/liteflow-core/pom.xml @@ -9,7 +9,7 @@ com.yomahub liteflow - 2.2.1 + 2.2.2 diff --git a/liteflow-core/src/main/java/com/yomahub/liteflow/flow/FlowBus.java b/liteflow-core/src/main/java/com/yomahub/liteflow/flow/FlowBus.java index 8cd660266..6e2c87713 100644 --- a/liteflow-core/src/main/java/com/yomahub/liteflow/flow/FlowBus.java +++ b/liteflow-core/src/main/java/com/yomahub/liteflow/flow/FlowBus.java @@ -19,9 +19,9 @@ import com.yomahub.liteflow.entity.config.Node; public class FlowBus { - private static Map chainMap; + private static Map chainMap = new HashMap<>(); - private static Map nodeMap; + private static Map nodeMap = new HashMap<>(); public static Chain getChain(String id) throws Exception{ if(chainMap == null || chainMap.isEmpty()){ @@ -31,9 +31,6 @@ public class FlowBus { } public static void addChain(String name,Chain chain){ - if(chainMap == null){ - chainMap = new HashMap<>(); - } chainMap.put(name, chain); } @@ -41,10 +38,11 @@ public class FlowBus { return MapUtils.isEmpty(chainMap); } + public static boolean containNode(String nodeId){ + return nodeMap.containsKey(nodeId); + } + public static void addNode(String nodeId, Node node) { - if(nodeMap == null) { - nodeMap = new HashMap<>(); - } nodeMap.put(nodeId, node); } diff --git a/liteflow-core/src/main/java/com/yomahub/liteflow/parser/XmlFlowParser.java b/liteflow-core/src/main/java/com/yomahub/liteflow/parser/XmlFlowParser.java index 0f67649d3..474d26be7 100644 --- a/liteflow-core/src/main/java/com/yomahub/liteflow/parser/XmlFlowParser.java +++ b/liteflow-core/src/main/java/com/yomahub/liteflow/parser/XmlFlowParser.java @@ -63,7 +63,9 @@ public abstract class XmlFlowParser { } }else{ for(Entry componentEntry : ComponentScaner.nodeComponentMap.entrySet()){ - FlowBus.addNode(componentEntry.getKey(), new Node(componentEntry.getKey(), componentEntry.getValue().getClass().getName(), componentEntry.getValue())); + if(!FlowBus.containNode(componentEntry.getKey())){ + FlowBus.addNode(componentEntry.getKey(), new Node(componentEntry.getKey(), componentEntry.getValue().getClass().getName(), componentEntry.getValue())); + } } } diff --git a/liteflow-spring-boot-starter/pom.xml b/liteflow-spring-boot-starter/pom.xml index 4c270e19a..5d855a45f 100644 --- a/liteflow-spring-boot-starter/pom.xml +++ b/liteflow-spring-boot-starter/pom.xml @@ -10,7 +10,7 @@ liteflow com.yomahub - 2.2.1 + 2.2.2 diff --git a/liteflow-test-spring/pom.xml b/liteflow-test-spring/pom.xml index 779ce38ac..33a556fda 100644 --- a/liteflow-test-spring/pom.xml +++ b/liteflow-test-spring/pom.xml @@ -9,7 +9,7 @@ liteflow com.yomahub - 2.2.1 + 2.2.2 diff --git a/liteflow-test-springboot/pom.xml b/liteflow-test-springboot/pom.xml index 974e5d3cc..0e8590192 100644 --- a/liteflow-test-springboot/pom.xml +++ b/liteflow-test-springboot/pom.xml @@ -9,7 +9,7 @@ liteflow com.yomahub - 2.2.1 + 2.2.2 diff --git a/pom.xml b/pom.xml index d8aab448b..98eae7edf 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ com.yomahub liteflow pom - 2.2.1 + 2.2.2 liteflow a lightweight and practical micro-process framework https://github.com/bryan31/liteflow