コード例 #1
0
 /**
  * Remove the sentinels that are marked as finished and the completion time has exceeded the
  * removal timeout.
  *
  * @param sentinels map of sentinels to clean
  */
 private synchronized void cleanupSentinels(final Map<TableName, SnapshotSentinel> sentinels) {
   long currentTime = EnvironmentEdgeManager.currentTime();
   Iterator<Map.Entry<TableName, SnapshotSentinel>> it = sentinels.entrySet().iterator();
   while (it.hasNext()) {
     Map.Entry<TableName, SnapshotSentinel> entry = it.next();
     SnapshotSentinel sentinel = entry.getValue();
     if (sentinel.isFinished()
         && (currentTime - sentinel.getCompletionTimestamp())
             > SNAPSHOT_SENTINELS_CLEANUP_TIMEOUT) {
       it.remove();
     }
   }
 }