public ConfigChangeLockResult lockForConfigChange(long windowStart, long windowEnd) {
    if (windowEnd < windowStart) {
      throw new IllegalArgumentException(
          "WindowStart=" + windowStart + " can not be smaller than WindowEnd=" + windowEnd);
    }
    try {
      if (lockWindowEnd == null) {
        // Create the node with the /llap-sasl/hiveuser/hostname/config-change/next-change path without retry
        lockWindowEnd = new DistributedAtomicLong(zooKeeperClient,
            String.join("/", workersPath.substring(0, workersPath.lastIndexOf('/')), CONFIG_CHANGE_PATH,
                CONFIG_CHANGE_NODE), (i, j, sleeper) -> false);
        lockWindowEnd.initialize(0L);
      }
      AtomicValue<Long> current = lockWindowEnd.get();
      if (!current.succeeded()) {
        LOG.debug("Can not get the current configuration lock time");
        return new ConfigChangeLockResult(false, -1L);
      }
      if (current.postValue() > windowStart) {
        LOG.debug("Can not lock window {}-{}. Current value is {}.", windowStart, windowEnd, current.postValue());
        return new ConfigChangeLockResult(false, current.postValue());
      }
      current = lockWindowEnd.compareAndSet(current.postValue(), windowEnd);
      if (!current.succeeded()) {
        LOG.debug("Can not lock window {}-{}. Current value is changed to {}.", windowStart, windowEnd,
            current.postValue());
        return new ConfigChangeLockResult(false, current.postValue());
      }
      return new ConfigChangeLockResult(true, current.postValue());
    } catch (Throwable t) {
      LOG.info("Can not reserve configuration change lock", t);
      return new ConfigChangeLockResult(false, -1L);
    }
  }
Locks the Llap Cluster for configuration change for the given time window.
@param windowStart The beginning of the time window when no other configuration change is allowed.
@param windowEnd The end of the time window when no other configuration change is allowed.
@return The result of the change (success if the lock is succeeded, and the next possible
configuration change time
llap-client/src/java/org/apache/hadoop/hive/llap/registry/impl/LlapZookeeperRegistryImpl.java