当前位置:首页 > 开发 > 开源软件 > 正文

[Zookeeper学习笔记之七]Zookeeper源代码分析之Zookeeper.States

发表于: 2014-07-29   作者:bit1129   来源:转载   浏览:
摘要: public enum States { CONNECTING, //Zookeeper服务器不可用,客户端处于尝试链接状态 ASSOCIATING, //??? CONNECTED, //链接建立,可以与Zookeeper服务器正常通信 CONNECTEDREADONLY, //处于只读状态的链接状态,只读模式可以在
    public enum States {
        CONNECTING, //Zookeeper服务器不可用,客户端处于尝试链接状态
        ASSOCIATING, //???
        CONNECTED, //链接建立,可以与Zookeeper服务器正常通信
        CONNECTEDREADONLY, //处于只读状态的链接状态,只读模式可以在构造Zookeeper时指定
        CLOSED, //会话关闭,显式调用Zookeeper的close方法
        AUTH_FAILED, //建立链接时,认证失败
        NOT_CONNECTED; //链接断开状态
        
        //会话在两种状态下处于Alive状态,没有关闭,没有认证失败
        //CONNECTING,NOT_CONNECTED都出于Alive状态
        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;
        }
    }

 

[Zookeeper学习笔记之七]Zookeeper源代码分析之Zookeeper.States

  • 0

    开心

    开心

  • 0

    板砖

    板砖

  • 0

    感动

    感动

  • 0

    有用

    有用

  • 0

    疑问

    疑问

  • 0

    难过

    难过

  • 0

    无聊

    无聊

  • 0

    震惊

    震惊

版权所有 IT知识库 CopyRight © 2009-2015 IT知识库 IT610.com , All Rights Reserved. 京ICP备09083238号