0

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

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

如何找到他们都确定的价值?

4

1 回答 1

0

在 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
于 2015-11-03T22:26:08.343 回答