public void queryComplete(QueryIdentifier queryIdentifier) {
    if (queryIdentifier != null) {
      synchronized (knownAppMasters) {
        LOG.debug("Query complete received for {}", queryIdentifier);
        Map<LlapNodeId, AMNodeInfo> amNodeInfoPerQuery = knownAppMasters.remove(queryIdentifier);

        // The AM can be used for multiple queries. This is an indication that a single query is complete.
        // We don't have a good mechanism to know when an app ends. Removing this right now ensures
        // that a new one gets created for the next query on the same AM.
        if (amNodeInfoPerQuery != null) {
          LOG.debug("Removed following AMs due to query complete:");
          for (AMNodeInfo amNodeInfo : amNodeInfoPerQuery.values()) {
            amNodeInfo.setIsDone(true);
            LOG.debug(amNodeInfo.toString());
          }
        }
        // TODO: not stopping umbilical explicitly as some taskKill requests may get scheduled during queryComplete
        // which will be using the umbilical. HIVE-16021 should fix this, until then leave umbilical open and wait for
        // it to be closed after max idle timeout (10s default)
      }
    }
  }
Responsible for communicating with various AMs.
llap-server/src/java/org/apache/hadoop/hive/llap/daemon/impl/AMReporter.java