List of usage examples for org.apache.zookeeper ZooKeeper removeAllWatches
public void removeAllWatches(String path, WatcherType watcherType, boolean local, VoidCallback cb, Object ctx)
From source file:org.apache.bookkeeper.zookeeper.ZooKeeperClient.java
License:Apache License
@Override public void removeAllWatches(String path, WatcherType watcherType, boolean local, VoidCallback cb, Object ctx) { ZooKeeper zkHandle = zk.get(); if (null == zkHandle) { ZooKeeperClient.super.removeAllWatches(path, watcherType, local, cb, ctx); } else {/*from ww w . j a v a 2s . c om*/ zkHandle.removeAllWatches(path, watcherType, local, cb, ctx); } }
From source file:org.apache.curator.framework.imps.RemoveWatchesBuilderImpl.java
License:Apache License
@Override public void performBackgroundOperation(final OperationAndData<String> operationAndData) throws Exception { try {//from www . j a va 2 s. com final TimeTrace trace = client.getZookeeperClient().startTracer("RemoteWatches-Background"); AsyncCallback.VoidCallback callback = new AsyncCallback.VoidCallback() { @Override public void processResult(int rc, String path, Object ctx) { trace.commit(); CuratorEvent event = new CuratorEventImpl(client, CuratorEventType.REMOVE_WATCHES, rc, path, null, ctx, null, null, null, null, null, null); client.processBackgroundOperation(operationAndData, event); } }; ZooKeeper zkClient = client.getZooKeeper(); NamespaceWatcher namespaceWatcher = makeNamespaceWatcher(operationAndData.getData()); if (namespaceWatcher == null) { zkClient.removeAllWatches(operationAndData.getData(), watcherType, local, callback, operationAndData.getContext()); } else { zkClient.removeWatches(operationAndData.getData(), namespaceWatcher, watcherType, local, callback, operationAndData.getContext()); } } catch (Throwable e) { backgrounding.checkError(e, null); } }