private boolean taskSucceeded(TezTaskAttemptID taskAttemptID) throws IOException, TezException {
      // Ensure only one final event is ever sent.
      if (!finalEventQueued.getAndSet(true)) {
        TezEvent statusUpdateEvent = new TezEvent(
            getStatusUpdateEvent(true, true), updateEventMetadata);
        TezEvent taskCompletedEvent = new TezEvent(new TaskAttemptCompletedEvent(),
            updateEventMetadata);
        if (LOG.isDebugEnabled()) {
          LOG.debug("Invoking OOB heartbeat for successful attempt: {}, isTaskDone={}", taskAttemptID, task.isTaskDone());
        }
        completionListener.fragmentCompleting(fragmentRequestId, SchedulerFragmentCompletingListener.State.SUCCESS);
        return !heartbeat(Lists.newArrayList(statusUpdateEvent, taskCompletedEvent)).shouldDie;
      } else {
        LOG.warn("A final task state event has already been sent. Not sending again");
        return askedToDie.get();
      }
    }
Sends out final events for task success.
@param taskAttemptID
@return
@throws IOException
          indicates an RPC communication failure.
@throws TezException
          indicates an exception somewhere in the AM.
llap-server/src/java/org/apache/hadoop/hive/llap/daemon/impl/LlapTaskReporter.java