public void deregisterZnode() {
    if (znode != null) {
      try {
        znode.close();
        LOG.warn("This server instance with path " + znode.getActualPath() +
                " is now de-registered from ZooKeeper. ");
      } catch (IOException e) {
        LOG.error("Failed to close the persistent ephemeral znode", e);
      } finally {
        setDeregisteredWithZooKeeper(true);
        znode = null;
      }
    }
  }
Adds a server instance to ZooKeeper as a znode.

@throws Exception
standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/common/ZooKeeperHiveHelper.java