code: public void cancel(TaskInProgress tip) {
      LOG.info("Canceling task "  + tip.getTask().getTaskID() + " of job " +
          tip.getTask().getJobID());
      // Cancel & remove the map completion finish thread for reduce tasks.
      if (!tip.getTask().isMapTask() && !tip.getTask().isTaskCleanupTask()) {
        if (!mapperWaitThreadMap.containsKey(tip)) {
          throw new RuntimeException("Mapper wait thread doesn't exist " +
              "for " + tip.getTask().getTaskID());
        }
        LOG.debug("Interrupting mapper wait thread for " +
            tip.getTask().getTaskID() + " job " +
            tip.getTask().getJobID());
        mapperWaitThreadMap.get(tip).interrupt();
        LOG.debug("Removing mapper wait thread for " +
            tip.getTask().getTaskID() + " job " + tip.getTask().getJobID());
        mapperWaitThreadMap.remove(tip);
      } else {
        LOG.debug(tip.getTask().getTaskID() + " is not a reduce task, so " +
            "not canceling mapper wait thread");
      }
      removeFromFinishingQueue(tip);
    }
docs: Called in case the task needs to be killed. Canceling will kill any map
  wait threads and also remove it from the queue of tasks that should be
  marked as finished.
  @param tip the killed TaskInProgress