/** Store block invalidation work. */ void addBlocksToBeInvalidated(List<Block> blocklist) { assert (blocklist != null && blocklist.size() > 0); synchronized (invalidateBlocks) { for (Block blk : blocklist) { invalidateBlocks.add(blk); } } }
/** Add a block to the block collection which will be invalidated on the specified datanode. */ synchronized void add(final Block block, final DatanodeInfo datanode, final boolean log) { LightWeightHashSet<Block> set = node2blocks.get(datanode); if (set == null) { set = new LightWeightHashSet<Block>(); node2blocks.put(datanode, set); } if (set.add(block)) { numBlocks++; if (log) { NameNode.blockStateChangeLog.info( "BLOCK* " + getClass().getSimpleName() + ": add " + block + " to " + datanode); } } }