mirror of
https://gitee.com/dromara/liteFlow.git
synced 2026-05-14 12:12:08 +08:00
!3 FlowExecutor类execute方法新增异常日志打印及优化FlowBus类方法
Merge pull request !3 from zendwang/refactor
This commit is contained in:
@@ -9,7 +9,6 @@ package com.yomahub.liteflow.core;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@@ -23,7 +22,6 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.yomahub.liteflow.entity.flow.Chain;
|
||||
import com.yomahub.liteflow.entity.flow.Node;
|
||||
import com.yomahub.liteflow.entity.data.DataBus;
|
||||
import com.yomahub.liteflow.entity.data.DefaultSlot;
|
||||
import com.yomahub.liteflow.entity.data.Slot;
|
||||
@@ -153,13 +151,14 @@ public class FlowExecutor {
|
||||
}
|
||||
|
||||
try {
|
||||
//执行chain
|
||||
// 执行chain
|
||||
chain.execute(slotIndex);
|
||||
}catch(Exception e){
|
||||
} catch (Exception e) {
|
||||
LOG.error("[{}]:chain[{}] execute error on slot[{}]", slot.getRequestId(), chain.getChainName(), slotIndex);
|
||||
slot.setSuccess(false);
|
||||
slot.setErrorMsg(e.getMessage());
|
||||
}finally{
|
||||
if(!isInnerChain) {
|
||||
} finally {
|
||||
if (!isInnerChain) {
|
||||
slot.printStep();
|
||||
DataBus.releaseSlot(slotIndex);
|
||||
}
|
||||
|
||||
@@ -20,9 +20,12 @@ public class FlowBus {
|
||||
private static Map<String, Chain> chainMap = new HashMap<>();
|
||||
|
||||
private static Map<String, Node> nodeMap = new HashMap<>();
|
||||
|
||||
public static Chain getChain(String id) throws Exception{
|
||||
if(chainMap == null || chainMap.isEmpty()){
|
||||
|
||||
private FlowBus() {
|
||||
}
|
||||
|
||||
public static Chain getChain(String id) throws Exception {
|
||||
if (MapUtils.isEmpty(chainMap)) {
|
||||
throw new Exception("please config the rule first");
|
||||
}
|
||||
return chainMap.get(id);
|
||||
|
||||
Reference in New Issue
Block a user