停机时清空zk客户端信息,修复重启时报出的zk连接已关闭的异常

This commit is contained in:
wurongjun@duiba.com.cn
2019-01-16 17:28:51 +08:00
parent e4177ab0ce
commit 47d7914304
2 changed files with 6 additions and 0 deletions

View File

@@ -34,6 +34,10 @@ public class ZkClientx extends ZkClient {
return clients.get(servers); return clients.get(servers);
} }
public static void clearClients() {
clients.clear();
}
public ZkClientx(String serverstring){ public ZkClientx(String serverstring){
this(serverstring, Integer.MAX_VALUE); this(serverstring, Integer.MAX_VALUE);
} }

View File

@@ -503,6 +503,8 @@ public class CanalController {
if (zkclientx != null) { if (zkclientx != null) {
zkclientx.close(); zkclientx.close();
} }
ZkClientx.clearClients();
} }
private void initCid(String path) { private void initCid(String path) {