mirror of
https://gitee.com/dromara/liteFlow.git
synced 2026-05-14 20:22:07 +08:00
优化sql轮询连接管理
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
package com.yomahub.liteflow.parser.redis.mode;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.text.StrFormatter;
|
||||
import cn.hutool.core.util.ReUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.yomahub.liteflow.builder.LiteFlowNodeBuilder;
|
||||
import com.yomahub.liteflow.enums.NodeTypeEnum;
|
||||
@@ -13,8 +11,6 @@ import com.yomahub.liteflow.parser.redis.vo.RedisParserVO;
|
||||
import org.redisson.config.Config;
|
||||
import org.redisson.config.SentinelServersConfig;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Redis 解析器通用接口
|
||||
*
|
||||
|
||||
@@ -30,7 +30,7 @@ public class ChainPollingTask implements Runnable {
|
||||
|
||||
private static final String NEW_CHAIN_PATTERN = "SELECT {} FROM {} WHERE {}=? AND {}=?";
|
||||
|
||||
public static Connection conn;
|
||||
private Connection conn;
|
||||
|
||||
private SQLParserVO sqlParserVO;
|
||||
|
||||
@@ -43,11 +43,11 @@ public class ChainPollingTask implements Runnable {
|
||||
public ChainPollingTask(SQLParserVO sqlParserVO, Map<String, String> chainSHAMap) {
|
||||
this.sqlParserVO = sqlParserVO;
|
||||
this.chainSHAMap = chainSHAMap;
|
||||
conn = LiteFlowJdbcUtil.getConn(sqlParserVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
conn = LiteFlowJdbcUtil.getConn(sqlParserVO);
|
||||
PreparedStatement stmt = null;
|
||||
ResultSet rs = null;
|
||||
try{
|
||||
@@ -114,7 +114,7 @@ public class ChainPollingTask implements Runnable {
|
||||
LOG.error("[Exception during SQL chain polling] " + e.getMessage(), e);
|
||||
} finally {
|
||||
// 关闭连接
|
||||
LiteFlowJdbcUtil.close(null, stmt, rs);
|
||||
LiteFlowJdbcUtil.close(conn, stmt, rs);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ public class ScriptPollingTask implements Runnable {
|
||||
|
||||
private static final String SCRIPT_KEY_FIELD = "script_concat";
|
||||
|
||||
public static Connection conn;
|
||||
private Connection conn;
|
||||
|
||||
private SQLParserVO sqlParserVO;
|
||||
|
||||
@@ -46,12 +46,12 @@ public class ScriptPollingTask implements Runnable {
|
||||
public ScriptPollingTask(SQLParserVO sqlParserVO, Map<String, String> scriptSHAMap) {
|
||||
this.sqlParserVO = sqlParserVO;
|
||||
this.scriptSHAMap = scriptSHAMap;
|
||||
conn = LiteFlowJdbcUtil.getConn(sqlParserVO);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
conn = LiteFlowJdbcUtil.getConn(sqlParserVO);
|
||||
PreparedStatement stmt = null;
|
||||
ResultSet rs = null;
|
||||
try {
|
||||
@@ -133,7 +133,7 @@ public class ScriptPollingTask implements Runnable {
|
||||
LOG.error("[Exception during SQL script polling] " + e.getMessage(), e);
|
||||
} finally {
|
||||
// 关闭连接
|
||||
LiteFlowJdbcUtil.close(null, stmt, rs);
|
||||
LiteFlowJdbcUtil.close(conn, stmt, rs);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import cn.hutool.core.io.file.FileNameUtil;
|
||||
import cn.hutool.core.util.ReUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.yomahub.liteflow.builder.LiteFlowNodeBuilder;
|
||||
import com.yomahub.liteflow.builder.el.LiteFlowChainELBuilder;
|
||||
|
||||
Reference in New Issue
Block a user