2015-11-03 55 views
0

我知道Zookeeper服務器有一個名爲「tickTime」(最小心跳時間= 2 * ticktime)的配置,客戶端可以請求「會話超時」。如何檢查現有Zookeeper Ephemeral節點的超時?

當連接建立時,它會得到一個會話超時關聯。這是在客戶端和服務器之間進行協商的。

如何找到他們雙方均已確定的價值?

回答

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