{
boolean[] needCreate = Arrays.copyOf(needSet, needSet.length);
createCbList = create(paths, records, needCreate, pathsCreated, options);
for (int i = 0; i < createCbList.length; i++)
{
CreateCallbackHandler createCb = createCbList[i];
if (createCb == null)
{
continue;
}
Code rc = Code.get(createCb.getRc());
switch (rc)
{
case OK:
setStats.set(i, ZNode.ZERO_STAT);
needSet[i] = false;
break;
case NODEEXISTS:
retry = true;
break;
default:
// if creation fails on error other than NodeExists
// no need to retry set
needSet[i] = false;
break;
}
}
}
}
while (retry);
// construct return results
for (int i = 0; i < cbList.length; i++)
{
SetDataCallbackHandler cb = cbList[i];
Code rc = Code.get(cb.getRc());
if (rc == Code.OK)
{
success[i] = true;
}
else if (rc == Code.NONODE)
{
CreateCallbackHandler createCb = createCbList[i];
if (Code.get(createCb.getRc()) == Code.OK)
{
success[i] = true;
}
}
}