/** 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(); } } } }
void setTimeStamp() { timeStamp = FSNamesystem.now(); }
PendingBlockInfo(int numReplicas) { this.timeStamp = FSNamesystem.now(); this.numReplicasInProgress = numReplicas; }