protected boolean doConnectAndCreateZkPath() {
        if (RpcServerConf.ENABLE_ZK_REGISTRY) {
            String path = ZkPathUtil.buildPath(NaviCommonConstant.ZOOKEEPER_BASE_PATH,
                    RpcServerConf.ZK_REGISTRY_NAMESPACE);
            try {
                LOG.info("Connecting to zookeeper server - " + RpcServerConf.ZK_SERVER_LIST);
                zkClient = new SimpleZooKeeperClient(RpcServerConf.ZK_SERVER_LIST,
                        RpcServerConf.ZK_DIGEST_AUTH, new ServerServiceWatcher());
                LOG.info("Connect to zookeeper server successfully!");
                LOG.info("Trying create service registry path - " + path);
                zkClient.createNodeForRecursive(path, "".getBytes());
                LOG.info("Create service registry path successfully!");
            } catch (NodeExistsException e) {
                LOG.warn("Zookeeper path is already exists - " + path);
            } catch (Exception e) {
                LOG.error("Zookeeper client initialization failed, " + e.getMessage(), e);
                return false;
            }
        }
        return true;
    }
protected boolean doConnectAndCreateZkPath ( ) { if ( RpcServerConf . ENABLE_ZK_REGISTRY ) { String path = ZkPathUtil . buildPath ( NaviCommonConstant . ZOOKEEPER_BASE_PATH , RpcServerConf . ZK_REGISTRY_NAMESPACE ) ; try { LOG . info ( "Connecting to zookeeper server - " + RpcServerConf . ZK_SERVER_LIST ) ; zkClient = new SimpleZooKeeperClient ( RpcServerConf . ZK_SERVER_LIST , RpcServerConf . ZK_DIGEST_AUTH , new ServerServiceWatcher ( ) ) ; LOG . info ( "Connect to zookeeper server successfully!" ) ; LOG . info ( "Trying create service registry path - " + path ) ; zkClient . createNodeForRecursive ( path , "" . getBytes ( ) ) ; LOG . info ( "Create service registry path successfully!" ) ; } catch ( NodeExistsException e ) { LOG . warn ( "Zookeeper path is already exists - " + path ) ; } catch ( Exception e ) { LOG . error ( "Zookeeper client initialization failed, " + e . getMessage ( ) , e ) ; return false ; } } return true ; }
如果启用了zookeeper注册机制，那么尝试连接zookeeper并且创建服务的根node节点

@return 如果连接并且创建节点成功返回true，否则false