// Much better Fqn f = Fqn.fromString("/a/b/c"); for (int i=0; i
@version $Revision: 6776 $
}
public static void sendEvictAllNotification(Cache cache, Fqn region, Object member, Option option)
{
setInvocationOption(cache, option);
Fqn f = Fqn.fromRelativeElements(region, Internal.NODE, member == null ? Internal.LOCAL : member);
cache.put(f, ITEM, DUMMY);
}
prepareContextOptions();
cache.put(target, nd.getAttributes());
// Check whether this is an integration into the buddy backup
// subtree
Fqn tferFqn = nd.getFqn();
boolean move = target.isChildOrEquals(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN)
&& !tferFqn.isChildOrEquals(target);
// If it is an integration, calculate how many levels of offset
int offset = move ? target.size() - tferFqn.size() : 0;
integrateStateTransferChildren(target, offset, nodeDataIterator);
integrateRetainedNodes(target);
}
private NodeData integrateStateTransferChildren(Fqn parentFqn, int offset, Iterator<NodeData> nodeDataIterator)
throws IOException, ClassNotFoundException
{
int parentLevel = parentFqn.size();
int targetLevel = parentLevel + 1;
Fqn fqn;
int size;
NodeData nd = nodeDataIterator.hasNext() ? nodeDataIterator.next() : null;
while (nd != null && !nd.isMarker())
{
fqn = nd.getFqn();
// If we need to integrate into the buddy backup subtree,
// change the Fqn to fit under it
if (offset > 0)
{
fqn = Fqn.fromRelativeFqn(parentFqn.getAncestor(offset), fqn);
}
size = fqn.size();
if (size <= parentLevel)
{
return nd;
}
else if (size > targetLevel)
}
@Override
public Object visitGetChildrenNamesCommand(InvocationContext ctx, GetChildrenNamesCommand command) throws Throwable
{
Fqn fqn = command.getFqn();
if (fqn != null)
{
loadIfNeeded(ctx, fqn, null, false, false, false, false, false, true, true);
loadChildren(fqn, dataContainer.peekInternalNode(fqn, true), false, false, ctx);
}
if (list != null && list.size() > 0)
{
ListIterator i = list.listIterator(list.size());
while (i.hasPrevious())
{
Fqn fqn = (Fqn) i.previous();
try
{
dataContainer.evict(fqn, false);
}
catch (CacheException e)
}
@Override
public Object visitClearDataCommand(InvocationContext ctx, ClearDataCommand command) throws Throwable
{
Fqn fqn = command.getFqn();
if (fqn != null && !useCacheStore)
{
loadIfNeeded(ctx, fqn, null, false, true, false, false, false, false, true);
}
return invokeNextInterceptor(ctx, command);
return result;
}
private Node getInternalNode(Node parentNode, Fqn internalFqn)
{
Fqn parentFqn = parentNode.getFqn();
Object name = internalFqn.get(parentFqn.size());
prepareContextOptions();
Node result = parentNode.getChild(name);
if (result != null && internalFqn.size() < result.getFqn().size())
{
// need to recursively walk down the tree
}
// Create one DataNode per child, mark as UNINITIALIZED
for (Object name : childrenNames)
{
Fqn childFqn = Fqn.fromRelativeElements(fqn, name);
// create child if it didn't exist
NodeSPI child = helper.wrapNodeForWriting(ctxt, childFqn, true, true, true, false, false);
if (child.isCreated()) child.setDataLoaded(false);
if ((isMove || isActivation) && recursive)
if (log.isInfoEnabled()) log.info("Assigning self to buddy group " + newGroup);
buddyGroupsIParticipateIn.put(newGroup.getDataOwner(), newGroup);
// Integrate state transfer from the data owner of the buddy group
Fqn integrationBase = buddyFqnTransformer.getBackupRoot(newGroup.getDataOwner());
if (state.isEmpty())
{
if (configuredToFetchState())
log.info("Data owner has no state to set, even though buddy is configured to accept state. Assuming there is no data on the data owner.");
// create the backup region anyway
Option o = cache.getInvocationContext().getOptionOverrides();
o.setSkipCacheStatusCheck(true);
o = cache.getInvocationContext().getOptionOverrides();
o.setCacheModeLocal(true);
o.setSkipCacheStatusCheck(true);
cache.put(Fqn.fromElements(BUDDY_BACKUP_SUBTREE, newGroup.getGroupName()), (Map) Collections.emptyMap());
}
else
{
for (Map.Entry<Fqn, byte[]> entry : state.entrySet())
{
Fqn fqn = entry.getKey();
if (!regionManager.isInactive(fqn))
{
if (trace) log.trace("Integrating state for region " + fqn);
//ClassLoader cl = (marshaller == null) ? null : marshaller.getClassLoader(fqnS);
Fqn integrationRoot = Fqn.fromRelativeFqn(integrationBase, fqn);
byte[] stateBuffer = entry.getValue();
MarshalledValueInputStream in = null;
try
{
Collection<Region> regions = regionManager.getAllRegions(Region.Type.MARSHALLING);
if (regions.size() > 0)
{
for (Region r : regions)
{
Fqn f = r.getFqn();
state = acquireState(f);
if (state != null) stateMap.put(f, state);
}
}
else if (!configuration.isInactiveOnStartup())
Related Classes of org.jboss.cache.Fqn
Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.