in curator-framework/src/main/java/org/apache/curator/framework/imps/CreateBuilderImpl.java [603:658]
public void performBackgroundOperation(final OperationAndData<PathAndBytes> operationAndData) throws Exception {
try {
final OperationTrace trace =
client.getZookeeperClient().startAdvancedTracer("CreateBuilderImpl-Background");
final byte[] data = operationAndData.getData().getData();
AsyncCallback.Create2Callback callback = new AsyncCallback.Create2Callback() {
@Override
public void processResult(int rc, String path, Object ctx, String name, Stat stat) {
trace.setReturnCode(rc)
.setRequestBytesLength(data)
.setPath(path)
.commit();
if ((stat != null) && (storingStat != null)) {
DataTree.copyStat(stat, storingStat);
}
if ((rc == KeeperException.Code.NONODE.intValue()) && createParentsIfNeeded) {
backgroundCreateParentsThenNode(
client,
operationAndData,
operationAndData.getData().getPath(),
acling.getACLProviderForParents(),
createParentsAsContainers);
} else if ((rc == KeeperException.Code.NODEEXISTS.intValue()) && setDataIfExists) {
backgroundSetData(
client,
operationAndData,
operationAndData.getData().getPath(),
backgrounding);
} else if ((rc == KeeperException.Code.NODEEXISTS.intValue()) && idempotent) {
backgroundCheckIdempotent(
client,
operationAndData,
operationAndData.getData().getPath(),
backgrounding);
} else {
sendBackgroundResponse(rc, path, ctx, name, stat, operationAndData);
}
}
};
client.getZooKeeper()
.create(
operationAndData.getData().getPath(),
data,
acling.getAclList(operationAndData.getData().getPath()),
createMode,
callback,
backgrounding.getContext(),
ttl);
} catch (Throwable e) {
backgrounding.checkError(e, null);
}
}