/** * Check if node exists asynchronously. * * @param path * @param watch * @param callback * @throws InterruptedException * @throws KeeperException */ public void exists(Object path, boolean watch, final Closure callback) throws InterruptedException, KeeperException { zookeeper.exists( getPathAsString(path), watch, new AsyncCallback.StatCallback() { public void processResult(int rc, String path, Object ctx, Stat stat) { callback.setProperty("returnCode", rc); callback.setProperty("path", path); callback.setDelegate(ctx); callback.call(stat); } }, this); }
/** * Check if a node exists synchronously. * * @param path * @param watch * @return * @throws InterruptedException * @throws KeeperException */ public Stat exists(Object path, boolean watch) throws InterruptedException, KeeperException { return zookeeper.exists(getPathAsString(path), watch); }