private synchronized void purgeExpiredTasks() {
    for (Iterator<TaskAndWeakRefPair> it = tasks.iterator(); it.hasNext();) {
      TaskAndWeakRefPair pair = it.next();
      MonitoredTask stat = pair.get();

      if (pair.isDead()) {
        // The class who constructed this leaked it. So we can
        // assume it's done.
        if (stat.getState() == MonitoredTaskImpl.State.RUNNING) {
          LOG.warn("Status " + stat + " appears to have been leaked");
          stat.cleanup();
        }
      }

      if (canPurge(stat)) {
        it.remove();
      }
    }
  }
Create a task group which contains a series of monitored tasks for users to inquire about the
status
@param ignoreSubTasksInTaskMonitor whether to ignore to track(e.g. show/clear/expire) the task
                                   in the {@link TaskMonitor}
@param description                 description of the status
@return a group of monitored tasks
hbase-server/src/main/java/org/apache/hadoop/hbase/monitoring/TaskMonitor.java