【问题标题】:How to check timeout for a existing Zookeeper Ephemeral Node?如何检查现有 Zookeeper 临时节点的超时?
【发布时间】:2015-11-04 06:26:08
【问题描述】:

我知道 Zookeeper Server 有一个名为“tickTime”的配置(最小心跳时间 =2*ticktime),客户端可以请求“会话超时”。

当建立连接时.. 它会获得一个与之相关的会话超时。这是在客户端和服务器之间协商的。

如何找到他们都选择的价值?

【问题讨论】:

    标签: apache-zookeeper apache-curator


    【解决方案1】:

    在 Java 中,ZooKeeper 实例有一个方法:getSessionTimeout()。对此的评论是:

    public int getSessionTimeout()
    
    The negotiated session timeout for this ZooKeeper client instance. 
    The value returned is not valid until the client connects to a server 
    and may change after a re-connect. This method is NOT thread safe
    
    Returns:
    current session timeout
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-07-21
      相关资源
      最近更新 更多