private static void appendPeerState(ZKWatcher zkw, String znodeToProcess, StringBuilder sb)
    throws KeeperException, InvalidProtocolBufferException {
    String peerState =
      zkw.getConfiguration().get("zookeeper.znode.replication.peers.state", "peer-state");
    int pblen = ProtobufUtil.lengthOfPBMagic();
    for (String child : ZKUtil.listChildrenNoWatch(zkw, znodeToProcess)) {
      if (!child.equals(peerState)) {
        continue;
      }

      String peerStateZnode = ZNodePaths.joinZNode(znodeToProcess, child);
      sb.append("\n").append(peerStateZnode).append(": ");
      byte[] peerStateData;
      try {
        peerStateData = ZKUtil.getData(zkw, peerStateZnode);
        ReplicationProtos.ReplicationState.Builder builder =
          ReplicationProtos.ReplicationState.newBuilder();
        ProtobufUtil.mergeFrom(builder, peerStateData, pblen, peerStateData.length - pblen);
        sb.append(builder.getState().name());
      } catch (IOException ipbe) {
        LOG.warn("Got Exception while parsing peer: " + znodeToProcess, ipbe);
      } catch (InterruptedException e) {
        zkw.interruptedException(e);
        return;
      }
    }
  }
Returns a string with replication znodes and position of the replication log
@param zkw reference to the {@link ZKWatcher} which also contains configuration and operation
@return aq string of replication znodes and log positions
hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKDump.java