code: public static void createEphemeralPath(ZkClient zkClient, String path, String data) {
          try {
              zkClient.createEphemeral(path, Utils.getBytes(data));
          } catch (ZkNoNodeException e) {
              createParentPath(zkClient, path);
              zkClient.createEphemeral(path, Utils.getBytes(data));
          }
      }
docs: Create an ephemeral node with the given path and data. Create parents if necessary.
  @param zkClient client of zookeeper
  @param path node path of zookeeper
  @param data node data