code: private synchronized byte[] getNodeData(String node, Stat stat,
        boolean retry, boolean sync)
        throws IOException, KeeperException, InterruptedException {
      int failures = 0;
      
      byte[] data = null;
      while (data == null) {
        initZK();
        try {
          if (sync) {
            SyncUtil su = new SyncUtil();
            su.sync(zk, node);
          }
          data = zk.getData(node, watch, stat);
          if (data == null && retry) {
            // Failover is in progress
            // reset the failures
            failures = 0;
            DistributedAvatarFileSystem.LOG.info("Failover is in progress. Waiting");
            try {
              Thread.sleep(failoverCheckPeriod);
            } catch (InterruptedException iex) {
              Thread.currentThread().interrupt();
            }
          } else {
            return data;
          }
        } catch (KeeperException kex) {
          if (KeeperException.Code.CONNECTIONLOSS == kex.code()
              && failures < ZK_CONNECTION_RETRIES) {
            failures++;
            // This means there was a failure connecting to zookeeper
            // we should retry since some nodes might be down.
            continue;
          }
          throw kex;
        } finally {
          if (closeConnOnEachOp) {
            stopZK();
          }
        }
      }
      return data;
    }
docs: Get the information stored in the node of zookeeper. If retry is set
  to true it will keep retrying until the data in that node is available
  (failover case). If the retry is set to false it will return the first
  value that it gets from the zookeeper.
  
  @param node the path of zNode in zookeeper
  @param stat {@link Stat} object that will contain stats of the node
  @param retry if true will retry until the data in znode is not null
  @return byte[] the data in the znode
  @throws IOException
  @throws KeeperException
  @throws InterruptedException