@Override
      public void run() {
        while (true) {
          int executorCount = getExecutorCount(true); // Trigger an update if needed.
          
          if (executorCount != lastExecutorCount && lastExecutorCount >= 0) {
            clusterChangedCallback.run();
          }
          lastExecutorCount = executorCount;
          try {
            Thread.sleep(CLUSTER_INFO_UPDATE_INTERVAL_MS / 2);
          } catch (InterruptedException e) {
            LOG.info("Cluster state update thread was interrupted");
            return;
          }
        }
      }
Implements query resource allocation using guaranteed tasks.
ql/src/java/org/apache/hadoop/hive/ql/exec/tez/GuaranteedTasksAllocator.java