@Override public OperationFuture<Stat> exists(String path, Watcher watcher) { if (watcher == null) { return super.exists(path, null); } final RewatchOnExpireWatcher wrappedWatcher = new RewatchOnExpireWatcher(this, ActionType.EXISTS, path, watcher); OperationFuture<Stat> result = super.exists(path, wrappedWatcher); Futures.addCallback(result, new FutureCallback<Stat>() { @Override public void onSuccess(Stat result) { wrappedWatcher.setLastResult(result); } @Override public void onFailure(Throwable t) { // No-op } }); return result; }
@Override public OperationFuture<Stat> exists(String path, Watcher watcher) { if (watcher == null) { return super.exists(path, null); } final RewatchOnExpireWatcher wrappedWatcher = new RewatchOnExpireWatcher(this, ActionType.EXISTS, path, watcher); OperationFuture<Stat> result = super.exists(path, wrappedWatcher); Futures.addCallback(result, new FutureCallback<Stat>() { @Override public void onSuccess(Stat result) { wrappedWatcher.setLastResult(result); } @Override public void onFailure(Throwable t) { // No-op } }); return result; }
@Override public OperationFuture<Stat> exists(final String path, final Watcher watcher) { final SettableOperationFuture<Stat> result = SettableOperationFuture.create(path, Threads.SAME_THREAD_EXECUTOR); Futures.addCallback(super.exists(path, watcher), new OperationFutureCallback<Stat>(OperationType.EXISTS, System.currentTimeMillis(), path, result, new Supplier<OperationFuture<Stat>>() { @Override public OperationFuture<Stat> get() { return FailureRetryZKClient.super.exists(path, watcher); } })); return result; }
@Override public OperationFuture<Stat> exists(final String path, final Watcher watcher) { final SettableOperationFuture<Stat> result = SettableOperationFuture.create(path, Threads.SAME_THREAD_EXECUTOR); Futures.addCallback(super.exists(path, watcher), new OperationFutureCallback<Stat>(OperationType.EXISTS, System.currentTimeMillis(), path, result, new Supplier<OperationFuture<Stat>>() { @Override public OperationFuture<Stat> get() { return FailureRetryZKClient.super.exists(path, watcher); } })); return result; }