mirror of
https://github.com/alibaba/canal.git
synced 2026-11-04 00:30:15 +08:00
@@ -68,7 +68,6 @@ public class CanalController {
|
|||||||
|
|
||||||
private CanalInstanceGenerator instanceGenerator;
|
private CanalInstanceGenerator instanceGenerator;
|
||||||
private ZkClientx zkclientx;
|
private ZkClientx zkclientx;
|
||||||
private String zkServers;
|
|
||||||
|
|
||||||
private CanalMQStarter canalMQStarter;
|
private CanalMQStarter canalMQStarter;
|
||||||
|
|
||||||
@@ -133,7 +132,6 @@ public class CanalController {
|
|||||||
}
|
}
|
||||||
final String zkServers = getProperty(properties, CanalConstants.CANAL_ZKSERVERS);
|
final String zkServers = getProperty(properties, CanalConstants.CANAL_ZKSERVERS);
|
||||||
if (StringUtils.isNotEmpty(zkServers)) {
|
if (StringUtils.isNotEmpty(zkServers)) {
|
||||||
this.zkServers = zkServers;
|
|
||||||
zkclientx = ZkClientx.getZkClient(zkServers);
|
zkclientx = ZkClientx.getZkClient(zkServers);
|
||||||
// 初始化系统目录
|
// 初始化系统目录
|
||||||
zkclientx.createPersistent(ZookeeperPathUtils.DESTINATION_ROOT_NODE, true);
|
zkclientx.createPersistent(ZookeeperPathUtils.DESTINATION_ROOT_NODE, true);
|
||||||
@@ -508,11 +506,9 @@ public class CanalController {
|
|||||||
|
|
||||||
if (zkclientx != null) {
|
if (zkclientx != null) {
|
||||||
zkclientx.close();
|
zkclientx.close();
|
||||||
if (zkServers != null) {
|
|
||||||
ZkClientx.removeZkClient(zkServers);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//关闭时清理缓存
|
||||||
if (instanceConfigs != null) {
|
if (instanceConfigs != null) {
|
||||||
instanceConfigs.clear();
|
instanceConfigs.clear();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ public class ZooKeeperMetaManager extends AbstractCanalLifeCycle implements Cana
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void stop() {
|
public void stop() {
|
||||||
zkClientx = null;
|
zkClientx = null; //关闭时置空
|
||||||
super.stop();
|
super.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,7 +102,7 @@ public class ZooKeeperMetaManager extends AbstractCanalLifeCycle implements Cana
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<ClientIdentity> listAllSubscribeInfo(String destination) throws CanalMetaManagerException {
|
public List<ClientIdentity> listAllSubscribeInfo(String destination) throws CanalMetaManagerException {
|
||||||
if (zkClientx == null) {
|
if (zkClientx == null) { //重新加载时可能为空
|
||||||
return new ArrayList<ClientIdentity>();
|
return new ArrayList<ClientIdentity>();
|
||||||
}
|
}
|
||||||
String path = ZookeeperPathUtils.getDestinationPath(destination);
|
String path = ZookeeperPathUtils.getDestinationPath(destination);
|
||||||
|
|||||||
Reference in New Issue
Block a user