public AMNodeInfo registerTask(boolean externalClientRequest, String amLocation, int port, String umbilicalUser,
                                 Token<JobTokenIdentifier> jobToken, QueryIdentifier queryIdentifier,
                                 TezTaskAttemptID attemptId, boolean isGuaranteed) {
    if (LOG.isTraceEnabled()) {
      LOG.trace(
          "Registering for heartbeat: {}, queryIdentifier={}, attemptId={}",
          (amLocation + ":" + port), queryIdentifier, attemptId);
    }

    // Since we don't have an explicit AM end signal yet - we're going to create
    // and discard AMNodeInfo instances per query.
    synchronized (knownAppMasters) {
      LlapNodeId amNodeId = LlapNodeId.getInstance(amLocation, port);
      Map<LlapNodeId, AMNodeInfo> amNodeInfoPerQuery = knownAppMasters.get(queryIdentifier);
      if (amNodeInfoPerQuery == null) {
        amNodeInfoPerQuery = new HashMap<>();
        knownAppMasters.put(queryIdentifier, amNodeInfoPerQuery);
      }
      AMNodeInfo amNodeInfo = amNodeInfoPerQuery.get(amNodeId);
      if (amNodeInfo == null) {
        amNodeInfo = new AMNodeInfo(amNodeId, umbilicalUser, jobToken, queryIdentifier, retryPolicy,
          retryTimeout, socketFactory, conf);
        amNodeInfo.setIsExternalClientRequest(externalClientRequest);
        amNodeInfoPerQuery.put(amNodeId, amNodeInfo);
        // Add to the queue only the first time this is registered, and on
        // subsequent instances when it's taken off the queue.
        amNodeInfo.setNextHeartbeatTime(System.currentTimeMillis() + heartbeatInterval);
        pendingHeartbeatQueeu.add(amNodeInfo);
        // AMNodeInfo will only be cleared when a queryComplete is received for this query, or
        // when we detect a failure on the AM side (failure to heartbeat).
        // A single queueLookupCallable is added here. We have to make sure one instance stays
        // in the queue till the query completes.
      }
      amNodeInfo.addTaskAttempt(attemptId, isGuaranteed);
      return amNodeInfo;
    }
  }
Responsible for communicating with various AMs.
llap-server/src/java/org/apache/hadoop/hive/llap/daemon/impl/AMReporter.java