in curator-framework/src/main/java/org/apache/curator/framework/imps/GetChildrenBuilderImpl.java [160:207]
public void performBackgroundOperation(final OperationAndData<String> operationAndData) throws Exception {
try {
final OperationTrace trace =
client.getZookeeperClient().startAdvancedTracer("GetChildrenBuilderImpl-Background");
AsyncCallback.Children2Callback callback = new AsyncCallback.Children2Callback() {
@Override
public void processResult(int rc, String path, Object o, List<String> strings, Stat stat) {
watching.commitWatcher(rc, false);
if (strings == null) {
strings = Lists.newArrayList();
}
trace.setReturnCode(rc)
.setPath(path)
.setWithWatcher(watching.hasWatcher())
.setStat(stat)
.setResponseChildrenCount(strings.size())
.commit();
CuratorEventImpl event = new CuratorEventImpl(
client,
CuratorEventType.CHILDREN,
rc,
path,
null,
o,
stat,
null,
strings,
null,
null,
null);
client.processBackgroundOperation(operationAndData, event);
}
};
if (watching.isWatched()) {
client.getZooKeeper()
.getChildren(operationAndData.getData(), true, callback, backgrounding.getContext());
} else {
client.getZooKeeper()
.getChildren(
operationAndData.getData(),
watching.getWatcher(operationAndData.getData()),
callback,
backgrounding.getContext());
}
} catch (Throwable e) {
backgrounding.checkError(e, watching);
}
}