3 Star 0 Fork 5

src-openEuler/canal

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-fixed-issue-#4930-check-embeddedServerstate.patch 3.93 KB
一键复制 编辑 原始数据 按行查看 历史
zhangxingrong 提交于 2024-08-15 14:37 . add some upstream patchs
From 55a5e7592bb39170004b7dddd4083ed5c66d8e80 Mon Sep 17 00:00:00 2001
From: "jianghang.loujh" <[email protected]>
Date: Fri, 3 Nov 2023 11:04:11 +0800
Subject: [PATCH] fixed issue #4930 , check embeddedServerstate
---
.../otter/canal/deployer/CanalController.java | 43 ++++++++++---------
.../deployer/admin/CanalAdminController.java | 2 +-
2 files changed, 23 insertions(+), 22 deletions(-)
diff --git a/deployer/src/main/java/com/alibaba/otter/canal/deployer/CanalController.java b/deployer/src/main/java/com/alibaba/otter/canal/deployer/CanalController.java
index 11a915471c..e534763372 100644
--- a/deployer/src/main/java/com/alibaba/otter/canal/deployer/CanalController.java
+++ b/deployer/src/main/java/com/alibaba/otter/canal/deployer/CanalController.java
@@ -1,5 +1,26 @@
package com.alibaba.otter.canal.deployer;
+import static com.alibaba.otter.canal.deployer.CanalConstants.CANAL_DESTINATIONS;
+import static com.alibaba.otter.canal.deployer.CanalConstants.CANAL_DESTINATIONS_EXPR;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.util.stream.Collectors;
+
+import org.I0Itec.zkclient.IZkStateListener;
+import org.I0Itec.zkclient.exception.ZkNoNodeException;
+import org.I0Itec.zkclient.exception.ZkNodeExistsException;
+import org.apache.commons.lang.BooleanUtils;
+import org.apache.commons.lang.StringUtils;
+import org.apache.zookeeper.Watcher.Event.KeeperState;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
+
import com.alibaba.otter.canal.common.utils.AddressUtils;
import com.alibaba.otter.canal.common.zookeeper.ZkClientx;
import com.alibaba.otter.canal.common.zookeeper.ZookeeperPathUtils;
@@ -23,26 +44,6 @@
import com.google.common.base.Function;
import com.google.common.collect.MapMaker;
import com.google.common.collect.MigrateMap;
-import org.I0Itec.zkclient.IZkStateListener;
-import org.I0Itec.zkclient.exception.ZkNoNodeException;
-import org.I0Itec.zkclient.exception.ZkNodeExistsException;
-import org.apache.commons.lang.BooleanUtils;
-import org.apache.commons.lang.StringUtils;
-import org.apache.zookeeper.Watcher.Event.KeeperState;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.slf4j.MDC;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import java.util.stream.Collectors;
-
-import static com.alibaba.otter.canal.deployer.CanalConstants.CANAL_DESTINATIONS;
-import static com.alibaba.otter.canal.deployer.CanalConstants.CANAL_DESTINATIONS_EXPR;
/**
* canal调度控制器
@@ -601,7 +602,7 @@ public void stop() throws Throwable {
ZkClientx.clearClients();
// 需要释放 CanalServerWithEmbedded 否则主线程退出后,进程无法自动完整退出...
- if (embeddedCanalServer != null) {
+ if (embeddedCanalServer != null && embeddedCanalServer.isStart()) {
embeddedCanalServer.stop();
}
}
diff --git a/deployer/src/main/java/com/alibaba/otter/canal/deployer/admin/CanalAdminController.java b/deployer/src/main/java/com/alibaba/otter/canal/deployer/admin/CanalAdminController.java
index b50809e05e..a842a00718 100644
--- a/deployer/src/main/java/com/alibaba/otter/canal/deployer/admin/CanalAdminController.java
+++ b/deployer/src/main/java/com/alibaba/otter/canal/deployer/admin/CanalAdminController.java
@@ -37,7 +37,7 @@ public class CanalAdminController implements CanalAdmin {
private static final Logger logger = LoggerFactory.getLogger(CanalAdminController.class);
private String user;
private String passwd;
- private CanalStarter canalStater;
+ private CanalStarter canalStater;
public CanalAdminController(CanalStarter canalStater){
this.canalStater = canalStater;
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-openeuler/canal.git
[email protected]:src-openeuler/canal.git
src-openeuler
canal
canal
master

搜索帮助