List of usage examples for org.apache.hadoop.hdfs.server.protocol BlocksWithLocations getBlocks
public BlockWithLocations[] getBlocks()
From source file:com.sun.grid.herd.HerdLoadSensor.java
License:Open Source License
public void doMeasurement() { try {/*www .j a v a 2 s. c o m*/ rackName = node.getNetworkLocation(); BlocksWithLocations blocks = namenode.getBlocks(node, Long.MAX_VALUE); List<Long> blockIds = new ArrayList<Long>(100); for (BlocksWithLocations.BlockWithLocations block : blocks.getBlocks()) { blockIds.add(block.getBlock().getBlockId()); } blockStrings = buildBlockStrings(blockIds); log.fine("Rack is " + rackName); log.fine("Blocks are: " + blockStrings); } catch (IOException e) { log.warning("load sensor threw I/O exception while communicating with namenode: " + e.getMessage()); } }