コード例 #1
0
 /** Iterate through all items and detect timed-out items */
 void pendingReplicationCheck() {
   synchronized (pendingReplications) {
     Iterator iter = pendingReplications.entrySet().iterator();
     long now = FSNamesystem.now();
     FSNamesystem.LOG.debug("PendingReplicationMonitor checking Q");
     while (iter.hasNext()) {
       Map.Entry entry = (Map.Entry) iter.next();
       PendingBlockInfo pendingBlock = (PendingBlockInfo) entry.getValue();
       if (now > pendingBlock.getTimeStamp() + timeout) {
         Block block = (Block) entry.getKey();
         synchronized (timedOutItems) {
           timedOutItems.add(block);
         }
         FSNamesystem.LOG.warn("PendingReplicationMonitor timed out block " + block);
         iter.remove();
       }
     }
   }
 }
コード例 #2
0
 public void run() {
   while (fsRunning) {
     long period = Math.min(defaultRecheckInterval, timeout);
     try {
       pendingReplicationCheck();
       Thread.sleep(period);
     } catch (InterruptedException ie) {
       FSNamesystem.LOG.debug("PendingReplicationMonitor thread received exception. " + ie);
     }
   }
 }
コード例 #3
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);
       }
     }
   }
 }