in curator-framework/src/main/java/org/apache/curator/framework/imps/RemoveWatchesBuilderImpl.java [284:326]
public void performBackgroundOperation(final OperationAndData<String> operationAndData) throws Exception {
try {
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);
}
}