本文整理了Java中com.gopush.common.utils.zk.ZkUtils.init()
方法的一些代码示例,展示了ZkUtils.init()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZkUtils.init()
方法的具体详情如下:
包路径:com.gopush.common.utils.zk.ZkUtils
类名称:ZkUtils
方法名:init
[英]初始化zk链接
[中]初始化zk链接
代码示例来源:origin: lee123lee123/GoPush
@PostConstruct
public void init() {
zkUtils = new ZkUtils();
zkUtils.init(
zookeeperConfig.getServers(),
zookeeperConfig.getConnectionTimeout(),
zookeeperConfig.getSessionTimeout(),
zookeeperConfig.getMaxRetries(),
zookeeperConfig.getRetriesSleepTime(),
zookeeperConfig.getListenNamespace(),
new ZkStateListener() {
@Override
public void connectedEvent(CuratorFramework curator, ConnectionState state) {
log.info("DataCenterDiscovery 链接zk成功");
}
@Override
public void reconnectedEvent(CuratorFramework curator, ConnectionState state) {
log.info("DataCenterDiscovery 重新链接zk成功");
}
@Override
public void lostEvent(CuratorFramework curator, ConnectionState state) {
log.info("DataCenterDiscovery 链接zk丢失");
}
});
}
代码示例来源:origin: lee123lee123/GoPush
@PostConstruct
public void init() {
zkUtils = new ZkUtils();
zkUtils.init(
zookeeperConfig.getServers(),
zookeeperConfig.getConnectionTimeout(),
zookeeperConfig.getSessionTimeout(),
zookeeperConfig.getMaxRetries(),
zookeeperConfig.getRetriesSleepTime(),
zookeeperConfig.getNamespace(),
new ZkStateListener() {
@Override
public void connectedEvent(CuratorFramework curator, ConnectionState state) {
log.info("NodeServerRegister 链接zk成功");
registerNodeServer();
}
@Override
public void reconnectedEvent(CuratorFramework curator, ConnectionState state) {
log.info("NodeServerRegister 重新链接zk成功");
registerNodeServer();
}
@Override
public void lostEvent(CuratorFramework curator, ConnectionState state) {
log.info("NodeServerRegister 链接zk丢失");
}
});
}
代码示例来源:origin: lee123lee123/GoPush
@PostConstruct
public void init() {
zkUtils = new ZkUtils();
zkUtils.init(
zookeeperConfig.getServers(),
zookeeperConfig.getConnectionTimeout(),
zookeeperConfig.getSessionTimeout(),
zookeeperConfig.getMaxRetries(),
zookeeperConfig.getRetriesSleepTime(),
zookeeperConfig.getNamespace(),
new ZkStateListener() {
@Override
public void connectedEvent(CuratorFramework curator, ConnectionState state) {
log.info("DataCenterRegister 链接zk成功");
registerDataCenter();
}
@Override
public void reconnectedEvent(CuratorFramework curator, ConnectionState state) {
log.info("DataCenterRegister 重新链接zk成功");
registerDataCenter();
}
@Override
public void lostEvent(CuratorFramework curator, ConnectionState state) {
log.info("DataCenterRegister 链接zk丢失");
}
});
}
代码示例来源:origin: lee123lee123/GoPush
@PostConstruct
public void init() {
zkUtils = new ZkUtils();
zkUtils.init(
zookeeperConfig.getServers(),
zookeeperConfig.getConnectionTimeout(),
zookeeperConfig.getSessionTimeout(),
zookeeperConfig.getMaxRetries(),
zookeeperConfig.getRetriesSleepTime(),
zookeeperConfig.getListenNamespaceNodeServer(),
new ZkStateListener() {
@Override
public void connectedEvent(CuratorFramework curator, ConnectionState state) {
log.info("MonitorNodeServer 链接zk成功");
initNodeServerPool();
}
@Override
public void reconnectedEvent(CuratorFramework curator, ConnectionState state) {
log.info("MonitorNodeServer 重新链接zk成功");
initNodeServerPool();
}
@Override
public void lostEvent(CuratorFramework curator, ConnectionState state) {
log.info("MonitorNodeServer 链接zk丢失");
monitorNodeServerPool.clear();
}
});
listenNodeServer();
}
代码示例来源:origin: lee123lee123/GoPush
@PostConstruct
public void init() {
zkUtils = new ZkUtils();
zkUtils.init(
zookeeperConfig.getServers(),
zookeeperConfig.getConnectionTimeout(),
zookeeperConfig.getSessionTimeout(),
zookeeperConfig.getMaxRetries(),
zookeeperConfig.getRetriesSleepTime(),
zookeeperConfig.getListenNamespaceDataCenter(),
new ZkStateListener() {
@Override
public void connectedEvent(CuratorFramework curator, ConnectionState state) {
log.info("MonitorDataCenter 链接zk成功");
initDataCenterPool();
}
@Override
public void reconnectedEvent(CuratorFramework curator, ConnectionState state) {
log.info("MonitorDataCenter 重新链接zk成功");
initDataCenterPool();
}
@Override
public void lostEvent(CuratorFramework curator, ConnectionState state) {
log.info("MonitorDataCenter 链接zk丢失");
monitorDataCenterPool.clear();
}
});
listenDataCenter();
}
代码示例来源:origin: lee123lee123/GoPush
@PostConstruct
public void init() {
zkUtils = new ZkUtils();
zkUtils.init(
zookeeperConfig.getServers(),
zookeeperConfig.getConnectionTimeout(),
zookeeperConfig.getSessionTimeout(),
zookeeperConfig.getMaxRetries(),
zookeeperConfig.getRetriesSleepTime(),
zookeeperConfig.getListenNamespace(),
new ZkStateListener() {
@Override
public void connectedEvent(CuratorFramework curator, ConnectionState state) {
log.info("NodeServerDiscovery 链接zk成功");
initNodeServerDiscovery();
}
@Override
public void reconnectedEvent(CuratorFramework curator, ConnectionState state) {
log.info("NodeServerDiscovery 重新链接zk成功");
initNodeServerDiscovery();
}
@Override
public void lostEvent(CuratorFramework curator, ConnectionState state) {
log.info("NodeServerDiscovery 链接zk丢失");
nodeServerPool.clear();
nodeManager.clear();
}
});
listenNodeServerDiscovery();
}
内容来源于网络,如有侵权,请联系作者删除!