本文整理了Java中com.twitter.common.zookeeper.ZooKeeperClient.close()
方法的一些代码示例,展示了ZooKeeperClient.close()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZooKeeperClient.close()
方法的具体详情如下:
包路径:com.twitter.common.zookeeper.ZooKeeperClient
类名称:ZooKeeperClient
方法名:close
[英]Closes the current connection if any expiring the current ZooKeeper session. Any subsequent calls to this method will no-op until the next successful #get.
[中]如果当前ZooKeeper会话过期,则关闭当前连接。在下一次成功#get之前,对该方法的任何后续调用都不会执行。
代码示例来源:origin: twitter/distributedlog
public void close() {
zkClient.close();
}
}
代码示例来源:origin: com.senseidb.zu/zu-core
/**
* shuts down the cluster and closes connection to zookeeper
*/
public void shutdown() {
if (zkClient != null) {
zkClient.close();
}
}
代码示例来源:origin: com.twitter.common/zookeeper-testing
@Override public void execute() {
client.close();
}
});
代码示例来源:origin: org.apache.distributedlog/distributedlog-client
public void close() {
zkClient.close();
}
}
代码示例来源:origin: com.twitter/distributedlog-client
public void close() {
zkClient.close();
}
}
代码示例来源:origin: com.twitter.common/zookeeper
/**
* Checks to see if the client might reasonably re-try an operation given the exception thrown
* while attempting it. If the ZooKeeper session should be expired to enable the re-try to
* succeed this method will expire it as a side-effect.
*
* @param e the exception to test
* @return true if a retry can be attempted
*/
public boolean shouldRetry(KeeperException e) {
if (e instanceof SessionExpiredException) {
close();
}
return ZooKeeperUtils.isRetryable(e);
}
代码示例来源:origin: com.twitter.common/zookeeper
@Override public void process(WatchedEvent event) {
switch (event.getType()) {
// Guard the None type since this watch may be used as the default watch on calls by
// the client outside our control.
case None:
switch (event.getState()) {
case Expired:
LOG.info("Zookeeper session expired. Event: " + event);
close();
break;
case SyncConnected:
connected.countDown();
break;
}
}
synchronized (watchers) {
for (Watcher watcher : watchers) {
watcher.process(event);
}
}
}
};
代码示例来源:origin: com.twitter.common/zookeeper
close();
throw new TimeoutException("Timed out waiting for a ZK connection after "
+ connectionTimeout);
内容来源于网络,如有侵权,请联系作者删除!