@Override
    public void process(WatchedEvent event) {
        if (event.getState() == KeeperState.SyncConnected) {

            LOGGER.info("zk SyncConnected");
            connectedSignal.countDown();

        } else if (event.getState().equals(KeeperState.Disconnected)) {

            // 这时收到断开连接的消息，这里其实无能为力，因为这时已经和ZK断开连接了，只能等ZK再次开启了
            LOGGER.warn("zk Disconnected");

        } else if (event.getState().equals(KeeperState.Expired)) {

            if (!debug) {

                // 这时收到这个信息，表示，ZK已经重新连接上了，但是会话丢失了，这时需要重新建立会话。
                LOGGER.error("zk Expired");

                // just reconnect forever
                reconnect();
            } else {
                LOGGER.info("zk Expired");
            }

        } else if (event.getState().equals(KeeperState.AuthFailed)) {

            LOGGER.error("zk AuthFailed");
        }
    }
@ Override public void process ( WatchedEvent event ) { if ( event . getState ( ) == KeeperState . SyncConnected ) { LOGGER . info ( "zk SyncConnected" ) ; connectedSignal . countDown ( ) ; } else if ( event . getState ( ) . equals ( KeeperState . Disconnected ) ) { LOGGER . warn ( "zk Disconnected" ) ; } else if ( event . getState ( ) . equals ( KeeperState . Expired ) ) { if ( ! debug ) { LOGGER . error ( "zk Expired" ) ; reconnect ( ) ; } else { LOGGER . info ( "zk Expired" ) ; } } else if ( event . getState ( ) . equals ( KeeperState . AuthFailed ) ) { LOGGER . error ( "zk AuthFailed" ) ; } }
当连接成功时调用的