private void handleCreatedNode(String path) throws Exception {
    while (true) {
      State localState = state.get();
      if (localState == State.CLOSED || localState == State.LATENT) return;
      if (state.compareAndSet(localState, State.AFTER_SELECTION)) break;
    }
    nodePath.set(path);
    watchNode();
    CountDownLatch localLatch = initialCreateLatch.getAndSet(null);
    if (localLatch != null) {
      localLatch.countDown();
    }
    LOG.info("Acquired the slot znode {}{}", path,
        localLatch != null ? "; this is the initial assignment" : "");
  }
We would have used the curator ephemeral node with some extra logic but it doesn't handle
the EXISTS condition, which is crucial here; so we c/p parts of Curator and add our logic.
llap-client/src/java/org/apache/hadoop/hive/llap/registry/impl/SlotZnode.java