private static String[] getHostsForLocations(LocatedBlock block) {
    DatanodeInfo[] locations = getLocatedBlockLocations(block);
    String[] hosts = new String[locations.length];
    for (int i = 0; i < hosts.length; i++) {
      hosts[i] = locations[i].getHostName();
    }
    return hosts;
  }
Compute HDFS block distribution of a given HdfsDataInputStream. All HdfsDataInputStreams are
backed by a series of LocatedBlocks, which are fetched periodically from the namenode. This
method retrieves those blocks from the input stream and uses them to calculate
HDFSBlockDistribution. The underlying method in DFSInputStream does attempt to use locally
cached blocks, but may hit the namenode if the cache is determined to be incomplete. The method
also involves making copies of all LocatedBlocks rather than return the underlying blocks
themselves.
hbase-server/src/main/java/org/apache/hadoop/hbase/util/FSUtils.java