public boolean initClusterInfo() {
    if (!isUpdateNeeded()) return true;
    synchronized (updateInfoLock) {
      // At this point, no one will take the write lock and update, so we can do the last check.
      if (!isUpdateNeeded()) return true;
      if (svc == null) {
        try {
          svc = LlapRegistryService.getClient(conf);
        } catch (Throwable t) {
          LOG.info("Cannot create the client; ignoring", t);
          return false; // Don't fail; this is best-effort.
        }
      }
      ServiceInstanceSet<LlapServiceInstance> instances;
      try {
        instances = svc.getInstances(10);
      } catch (IOException e) {
        LOG.info("Cannot update cluster information; ignoring", e);
        return false; // Don't wait for the cluster if not started; this is best-effort.
      }
      int executorsLocal = 0, noConfigNodesLocal = 0;
      for (LlapServiceInstance si : instances.getAll()) {
        if (si instanceof InactiveServiceInstance) continue; // Shouldn't happen in getAll.
        Map<String, String> props = si.getProperties();
        if (props == null) {
          ++noConfigNodesLocal;
          continue;
        }
        try {
          int numExecutors = Integer.parseInt(props.get(ConfVars.LLAP_DAEMON_NUM_EXECUTORS.varname));
          executorsLocal += numExecutors;
          if (numExecutorsPerNode == -1) {
            numExecutorsPerNode = numExecutors;
          }
          if (memoryPerInstance == -1) {
            memoryPerInstance = si.getResource().getMemorySize() * 1024L * 1024L;
          }
        } catch (NumberFormatException e) {
          ++noConfigNodesLocal;
        }
      }
      noConfigNodeCount = noConfigNodesLocal;
      executorCount = executorsLocal;
      lastClusterUpdateNs = System.nanoTime();
      return true;
    }
  }
Synchronizes the actual update from the cluster; only one thread at a time.
ql/src/java/org/apache/hadoop/hive/ql/optimizer/physical/LlapClusterStateForCompile.java