Revert "修复测试类报错 (#4516)"

This reverts commit d899981354.
This commit is contained in:
rewerma
2022-12-06 16:41:17 +08:00
committed by GitHub
parent d899981354
commit f3bb0dd18d
89 changed files with 4470 additions and 1105 deletions

View File

@@ -38,7 +38,7 @@ public class ServerRunningMonitor extends AbstractCanalLifeCycle {
private ServerRunningData serverData;
// 当前实际运行的节点状态信息
private volatile ServerRunningData activeData;
private ScheduledExecutorService delayExecutor;
private ScheduledExecutorService delayExector = Executors.newScheduledThreadPool(1);
private int delayTime = 5;
private ServerRunningListener listener;
@@ -73,7 +73,7 @@ public class ServerRunningMonitor extends AbstractCanalLifeCycle {
initRunning();
} else {
// 否则就是等待delayTime,避免因网络瞬端或者zk异常,导致出现频繁的切换操作
delayExecutor.schedule(() -> initRunning(), delayTime, TimeUnit.SECONDS);
delayExector.schedule(() -> initRunning(), delayTime, TimeUnit.SECONDS);
}
}
@@ -90,7 +90,6 @@ public class ServerRunningMonitor extends AbstractCanalLifeCycle {
try {
processStart();
if (zkClient != null) {
delayExecutor = Executors.newScheduledThreadPool(1);
// 如果需要尽可能释放instance资源,不需要监听running节点,不然即使stop了这台机器,另一台机器立马会start
String path = ZookeeperPathUtils.getDestinationServerRunning(destination);
zkClient.subscribeDataChanges(path, dataListener);
@@ -123,10 +122,6 @@ public class ServerRunningMonitor extends AbstractCanalLifeCycle {
if (zkClient != null) {
String path = ZookeeperPathUtils.getDestinationServerRunning(destination);
zkClient.unsubscribeDataChanges(path, dataListener);
if (delayExecutor != null) {
delayExecutor.shutdown();
delayExecutor = null;
}
releaseRunning(); // 尝试一下release
} else {