public synchronized MonitoredTask addTask(String description, boolean withCompleteLast) {
    if (withCompleteLast) {
      MonitoredTask previousTask = this.tasks.peekLast();
      if (
        previousTask != null && previousTask.getState() != State.COMPLETE
          && previousTask.getState() != State.ABORTED
      ) {
        previousTask.markComplete("Completed");
      }
    }
    MonitoredTask task =
      TaskMonitor.get().createStatus(description, ignoreSubTasksInTaskMonitor, true);
    this.setStatus(description);
    this.tasks.addLast(task);
    delegate.setStatus(description);
    return task;
  }
Add a new task to the group, and before that might complete the last task in the group
@param description      the description of the new task
@param withCompleteLast whether to complete the last task in the group
@return the added new task
hbase-server/src/main/java/org/apache/hadoop/hbase/monitoring/TaskGroup.java