コード例 #1
0
 /** How many copies of this block is pending replication? */
 int getNumReplicas(Block block) {
   synchronized (pendingReplications) {
     PendingBlockInfo found = pendingReplications.get(block);
     if (found != null) {
       return found.getNumReplicas();
     }
   }
   return 0;
 }
コード例 #2
0
 /**
  * One replication request for this block has finished. Decrement the number of pending
  * replication requests for this block.
  */
 void remove(Block block) {
   synchronized (pendingReplications) {
     PendingBlockInfo found = pendingReplications.get(block);
     if (found != null) {
       FSNamesystem.LOG.debug("Removing pending replication for block" + block);
       found.decrementReplicas();
       if (found.getNumReplicas() <= 0) {
         pendingReplications.remove(block);
       }
     }
   }
 }