1

これがソースコードで、混乱させたのはステータス「closed」と「not_connected」です。(zookeeper version r3.4.5)

public enum States {
    CONNECTING, ASSOCIATING, CONNECTED, CONNECTEDREADONLY,
    CLOSED, AUTH_FAILED, NOT_CONNECTED;

    public boolean isAlive() {
        return this != CLOSED && this != AUTH_FAILED;
    }

    /**
     * Returns whether we are connected to a server (which
     * could possibly be read-only, if this client is allowed
     * to go to read-only mode)
     * */
    public boolean isConnected() {
        return this == CONNECTED || this == CONNECTEDREADONLY;
    }
}

セッションが期限切れになった場合 (ウォッチャーが期限切れのイベントをキャッチした場合)、isAlive() が false を返すことを意味しますか?

4

2 に答える 2