ctx.setOriginLocal(false);
// use a get() call into the cache to make sure cache loading takes place.
// no need to cache the original skipDataGravitation setting here - it will always be false of we got here!!
//todo 2.2 use dataContainer for peek and load the data in the CLInterceptor rather than using the SPI for than!!!
ctx.getOptionOverrides().setSkipDataGravitation(true);
Node actualNode = spi.getNode(fqn);
ctx.getOptionOverrides().setSkipDataGravitation(false);
if (trace) log.trace("In local tree, this is " + actualNode);
Fqn backupNodeFqn = null;
if (actualNode == null && searchSubtrees)
{
log.trace("Looking at backup trees.");
// need to loop through backupSubtree's children
Set allGroupNames = getBackupRoots();
if (allGroupNames != null)
{
for (Object groupName : allGroupNames)
{
// groupName is the name of a buddy group since all child names in this
// collection are direct children of BUDDY_BACKUP_SUBTREE_FQN
Fqn backupRoot = Fqn.fromRelativeElements(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN, (String) groupName);
if (buddyFqnTransformer.isDeadBackupRoot(backupRoot))
{
Set<Integer> deadChildNames = new TreeSet<Integer>(spi.getChildrenNames(backupRoot));
Integer[] elems = deadChildNames.toArray(new Integer[deadChildNames.size()]);
// these are integers. we need to start with the highest/most recent.
for (int i = elems.length - 1; i > -1; i--)
{
Integer versionOfDefunctData = elems[i];
backupNodeFqn = Fqn.fromRelativeFqn(Fqn.fromRelativeElements(backupRoot, versionOfDefunctData), fqn);
// use a get() call into the cache to make sure cache loading takes place.
ctx.getOptionOverrides().setSkipDataGravitation(true);
actualNode = spi.peek(backupNodeFqn, false);
ctx.getOptionOverrides().setSkipDataGravitation(false);
// break out of the inner loop searching through the dead node's various backups
if (actualNode != null) break;
}
}
else
{
backupNodeFqn = Fqn.fromRelativeFqn(backupRoot, fqn);
// use a get() call into the cache to make sure cache loading takes place.
ctx.getOptionOverrides().setSkipDataGravitation(true);
actualNode = spi.getNode(backupNodeFqn);
ctx.getOptionOverrides().setSkipDataGravitation(false);
}
if (trace)
log.trace("Looking for " + backupNodeFqn + ". Search result: " + actualNode);
// break out of outer loop searching through all available backups.
if (actualNode != null) break;
}
}
}
if (actualNode == null)
{
return GravitateResult.noDataFound();
}
else
{
// make sure we LOAD data for this node!!
actualNode.getData();
}
if (backupNodeFqn == null && searchSubtrees)
{
backupNodeFqn = buddyFqnTransformer.getBackupFqn(buddyFqnTransformer.getGroupNameFromAddress(localAddress), fqn);