mirror of
https://gitee.com/dromara/liteFlow.git
synced 2026-05-14 12:12:08 +08:00
提供FlowExecutorHolder的实现
This commit is contained in:
@@ -77,10 +77,6 @@ public class FlowExecutor {
|
||||
DataBus.init();
|
||||
}
|
||||
|
||||
public static FlowExecutor loadInstance(LiteflowConfig liteflowConfig){
|
||||
return new FlowExecutor(liteflowConfig);
|
||||
}
|
||||
|
||||
/**
|
||||
* FlowExecutor的初始化化方式,主要用于parse规则文件
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.yomahub.liteflow.core;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.yomahub.liteflow.exception.FlowExecutorNotInitException;
|
||||
import com.yomahub.liteflow.property.LiteflowConfig;
|
||||
|
||||
public class FlowExecutorHolder {
|
||||
|
||||
private static FlowExecutor flowExecutor;
|
||||
|
||||
public static FlowExecutor loadInstance(LiteflowConfig liteflowConfig){
|
||||
if (ObjectUtil.isNull(flowExecutor)){
|
||||
flowExecutor = new FlowExecutor(liteflowConfig);
|
||||
}
|
||||
return flowExecutor;
|
||||
}
|
||||
|
||||
public static FlowExecutor loadInstance(){
|
||||
if (ObjectUtil.isNull(flowExecutor)){
|
||||
throw new FlowExecutorNotInitException("flow executor is not initialized yet");
|
||||
}
|
||||
return flowExecutor;
|
||||
}
|
||||
|
||||
public static void clean(){
|
||||
flowExecutor = null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user