private synchronized List<LlapServiceInstance> getLlapServices(
      boolean doForceRefresh) throws IOException {
    if (!doForceRefresh && lastKnownInstances != null) {
      return new ArrayList<>(lastKnownInstances);
    }
    if (activeInstances == null) {
      registry.start();
      activeInstances = registry.getInstances();
    }
    Collection<LlapServiceInstance> daemons = activeInstances.getAll();
    if (daemons == null || daemons.isEmpty()) {
      throw new RuntimeException("No LLAPs found");
    }
    lastKnownInstances = daemons;
    return new ArrayList<LlapServiceInstance>(lastKnownInstances);
  }
Synchronized - LLAP registry and instance set are not thread safe.
llap-client/src/java/org/apache/hadoop/hive/llap/security/LlapTokenClient.java