private void sortLocatedBlocks(String clientMachine, LocatedBlocks blocks) { if (blocks != null) { List<LocatedBlock> blkList = blocks.getLocatedBlocks(); if (blkList == null || blkList.size() == 0) { // simply return, block list is empty return; } blockManager.getDatanodeManager().sortLocatedBlocks(clientMachine, blkList); // lastBlock is not part of getLocatedBlocks(), might need to sort it too LocatedBlock lastBlock = blocks.getLastLocatedBlock(); if (lastBlock != null) { ArrayList<LocatedBlock> lastBlockList = Lists.newArrayList(lastBlock); blockManager.getDatanodeManager().sortLocatedBlocks(clientMachine, lastBlockList); } } }
dm.sortLocatedBlocks(targetIp, blocks);
blockManager.getDatanodeManager().sortLocatedBlocks( clientMachine, blocks.getLocatedBlocks()); if (lastBlock != null) { ArrayList<LocatedBlock> lastBlockList = Lists.newArrayList(lastBlock); blockManager.getDatanodeManager().sortLocatedBlocks( clientMachine, lastBlockList);
blockManager.getDatanodeManager().sortLocatedBlocks( clientMachine, blocks.getLocatedBlocks()); if (lastBlock != null) { ArrayList<LocatedBlock> lastBlockList = Lists.newArrayList(lastBlock); blockManager.getDatanodeManager().sortLocatedBlocks( clientMachine, lastBlockList);