private void updateGuaranteedInRegistry(long tgVersionForZk, int newTotalGuaranteed) {
    if (amRegistry == null) return;
    synchronized (registryUpdateLock) {
      // Make sure the updates are not sent to ZK out of order compared to how we apply them in AM.
      if (tgVersionForZk <= tgVersionSent) return;
      try {
        amRegistry.updateGuaranteed(newTotalGuaranteed);
        tgVersionSent = tgVersionForZk;
      } catch (IOException ex) {
        // Ignore for now. HS2 will probably try to send us the count we already have again.
        // We are assuming here that if we can't talk to ZK we will eventually fail.
        LOG.error("Failed to update guaranteed count in registry; ignoring", ex);
      }
    }
  }
The difference between this and getTotalResources() is that this only gives currently free
resource instances, while the other lists all the instances that may become available in a
while.
llap-tez/src/java/org/apache/hadoop/hive/llap/tezplugins/LlapTaskSchedulerService.java