/** Remove the procedures that are marked as finished */
 private synchronized void cleanupCompletedRestoreInMap() {
   ProcedureExecutor<MasterProcedureEnv> procExec = master.getMasterProcedureExecutor();
   Iterator<Map.Entry<TableName, Long>> it = restoreTableToProcIdMap.entrySet().iterator();
   while (it.hasNext()) {
     Map.Entry<TableName, Long> entry = it.next();
     Long procId = entry.getValue();
     if (procExec.isRunning() && procExec.isFinished(procId)) {
       it.remove();
     }
   }
 }
 /**
  * Verify if the restore of the specified table is in progress.
  *
  * @param tableName table under restore
  * @return <tt>true</tt> if there is a restore in progress of the specified table.
  */
 private synchronized boolean isRestoringTable(final TableName tableName) {
   Long procId = this.restoreTableToProcIdMap.get(tableName);
   if (procId == null) {
     return false;
   }
   ProcedureExecutor<MasterProcedureEnv> procExec = master.getMasterProcedureExecutor();
   if (procExec.isRunning() && !procExec.isFinished(procId)) {
     return true;
   } else {
     this.restoreTableToProcIdMap.remove(tableName);
     return false;
   }
 }