mirror of
https://github.com/alibaba/canal.git
synced 2026-11-04 00:30:15 +08:00
停机时清空zk客户端信息,修复重启时报出的zk连接已关闭的异常
This commit is contained in:
@@ -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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user