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