@Override
  public WatchableTask<Optional<Stat>> exists(String path) {
    return new WatchableTask<Optional<Stat>>("zkExists: " + path) {
      @Override
      protected Promise run(Context context) throws Throwable {
        SettablePromise<Optional<Stat>> promise = Promises.settable();
        _zkClient.exists(path, _watcher, (int rc, String p, Object ctx, Stat stat) -> {
          KeeperException.Code code = KeeperException.Code.get(rc);
          switch (code) {
            case OK:
              promise.done(Optional.of(stat));
              break;
            case NONODE:
              promise.done(Optional.empty());
              break;
            default:
              promise.fail(KeeperException.create(code, p));
          }
        }, null);
        return promise;
      }
    };
  }
@Override
  public WatchableTask<Optional<Stat>> exists(String path) {
    return new WatchableTask<Optional<Stat>>("zkExists: " + path) {
      @Override
      protected Promise run(Context context) throws Throwable {
        SettablePromise<Optional<Stat>> promise = Promises.settable();
        _zkClient.exists(path, _watcher, (int rc, String p, Object ctx, Stat stat) -> {
          KeeperException.Code code = KeeperException.Code.get(rc);
          switch (code) {
            case OK:
              promise.done(Optional.of(stat));
              break;
            case NONODE:
              promise.done(Optional.empty());
              break;
            default:
              promise.fail(KeeperException.create(code, p));
          }
        }, null);
        return promise;
      }
    };
  }
@ Override public WatchableTask < Optional < Stat > > exists ( String path ) { return new WatchableTask < Optional < Stat > > ( "zkExists: " + path ) { @ Override protected Promise run ( Context context ) throws Throwable { SettablePromise < Optional < Stat >> promise = Promises . settable ( ) ; _zkClient . exists ( path , _watcher , ( int rc , String p , Object ctx , Stat stat ) -> { KeeperException . Code code = KeeperException . Code . get ( rc ) ; switch ( code ) { case OK : promise . done ( Optional . of ( stat ) ) ; break ; case NONODE : promise . done ( Optional . empty ( ) ) ; break ; default : promise . fail ( KeeperException . create ( code , p ) ) ; } } , null ) ; return promise ; } } ; }
{@inheritDoc}
{