@Override
  public void close() throws IOException {
    State currentState = state.getAndSet(State.CLOSED);
    if (currentState == State.CLOSED || currentState == State.LATENT) return;
    client.getConnectionStateListenable().removeListener(connectionStateListener);
    String localNodePath = nodePath.getAndSet(null);
    if (localNodePath == null) return;
    try {
      client.delete().guaranteed().forPath(localNodePath);
    } catch (KeeperException.NoNodeException ignore) {
    } catch (Exception e) {
      LOG.error("Deleting node: " + localNodePath, e);
      throw new IOException(e);
    }
  }
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