// Start accepting messages for the subtree, but
// queue them for later processing. We do this early
// to reduce the chance of discarding a prepare call
// whose corresponding commit will thus fail after activation
Region region = regionManager_.getRegion(fqn);
if (region == null)
region = regionManager_.createRegion(fqn, null, true);
region.startQueuing();
// If a classloader is registered for the node's region, use it
ClassLoader cl = region.getClassLoader();
// Request partial state from the cluster and integrate it
if (BuddyManager.isBackupFqn(fqn))
{
if (log.isDebugEnabled())
log.debug("Not attempting to load state for a buddy backup Fqn that has just been activated: " + fqn);
}
else
{
if (buddyManager == null)
{
// Get the state from any node that has it and put it
// in the main tree
if (subtreeRoot == null)
{
// We'll update this node with the state we receive
subtreeRoot = createSubtreeRootNode(fqn);
}
loadState(subtreeRoot, cl);
}
else
{
// Get the state from each DataOwner and integrate in their
// respective buddy backup tree
List buddies = buddyManager.getBackupDataOwners();
for (Iterator it = buddies.iterator(); it.hasNext();)
{
Address buddy = (Address) it.next();
if (getMembers() == null || !getMembers().contains(buddy))
continue;
Object[] sources = {buddy};
Fqn base = new Fqn(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN, BuddyManager.getGroupNameFromAddress(buddy));
Fqn buddyRoot = new Fqn(base, fqn);
subtreeRoot = findNode(buddyRoot);
if (subtreeRoot == null)
{
// We'll update this node with the state we receive
subtreeRoot = createSubtreeRootNode(buddyRoot);
}
_loadState(fqn, subtreeRoot, sources, cl);
}
}
}
// Lock out other activity on the region while we
// we process the queue and activate the region
List queue = region.getMethodCallQueue();
synchronized (queue)
{
processQueuedMethodCalls(queue);
region.activate();
}
}
catch (Throwable t)
{