Apache zookeeper 馆长何时以及为什么抛出ConnectionLossException?
我使用Curator 1.2.4,当我想监控一个znode的子节点的更改时,我会不断获取Apache zookeeper 馆长何时以及为什么抛出ConnectionLossException?,apache-zookeeper,apache-curator,Apache Zookeeper,Apache Curator,我使用Curator 1.2.4,当我想监控一个znode的子节点的更改时,我会不断获取ConnectionLossException 然后我实现了一个类似这样的监视程序 公共类CuratorChildWatcherImpl实现CuratorWatcher{ 私人馆长; 公共策展人ChildWatcherImpl(策展人框架客户){ this.client=client; } @凌驾 公共作废进程(WatchedEvent事件)引发异常{ List children=client.getChil
ConnectionLossException
然后我实现了一个类似这样的监视程序
公共类CuratorChildWatcherImpl实现CuratorWatcher{
私人馆长;
公共策展人ChildWatcherImpl(策展人框架客户){
this.client=client;
}
@凌驾
公共作废进程(WatchedEvent事件)引发异常{
List children=client.getChildren().usingWatcher(this.forPath)(event.getPath());
//和孩子们一起做其他事情。
}
}
如果connectionTimeout
设置为10秒,则代码每11秒抛出一次connectionossexception
。异常情况似乎是connectionTimeout
加1秒。为什么?
我检查了源代码,发现GetChildrenBuilderImpl将调用CuratorZookeeperClient的BlockUntlConnectedOrtimeout方法,该方法将每隔1秒检查一次连接状态
2013-04-17 17:22:08 [ERROR]-[com.netflix.curator.ConnectionState.getZooKeeper(ConnectionState.java:97)] Connection timed out for connection string (...) and timeout (10000) / elapsed (10317913)
org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss
at com.netflix.curator.ConnectionState.getZooKeeper(ConnectionState.java:94)
at com.netflix.curator.CuratorZookeeperClient.getZooKeeper(CuratorZookeeperClient.java:107)
at com.netflix.curator.framework.imps.CuratorFrameworkImpl.getZooKeeper(CuratorFrameworkImpl.java:413)
at com.netflix.curator.framework.imps.GetChildrenBuilderImpl$3.call(GetChildrenBuilderImpl.java:213)
at com.netflix.curator.framework.imps.GetChildrenBuilderImpl$3.call(GetChildrenBuilderImpl.java:202)
at com.netflix.curator.RetryLoop.callWithRetry(RetryLoop.java:106)
at com.netflix.curator.framework.imps.GetChildrenBuilderImpl.pathInForeground(GetChildrenBuilderImpl.java:198)
at com.netflix.curator.framework.imps.GetChildrenBuilderImpl.forPath(GetChildrenBuilderImpl.java:190)
at com.netflix.curator.framework.imps.GetChildrenBuilderImpl.forPath(GetChildrenBuilderImpl.java:37)
at com.netflix.curator.framework.imps.NamespaceWatcher.process(NamespaceWatcher.java:56)
at org.apache.zookeeper.ClientCnxn$EventThread.processEvent(ClientCnxn.java:521)
这是一个已知的错误,在馆长/动物园管理员的互动下被跟踪。这是在2.0.1孵化版本中修复的。这是馆长/动物园管理员交互中的一个已知错误,在下面进行了跟踪。它在2.0.1孵化版本中被修复。谢谢@Randgalt,我给你发了一些电子邮件,你已经告诉我了。抱歉没有更新这个问题。谢谢@Randgalt,我给你发了一些电子邮件,你已经告诉我了。抱歉,没有更新此问题。