public void unlockAll(NodeSPI<?, ?> node, Object owner) { // depth first. Set<? extends Node<?, ?>> children = node.getChildren(); if (children != null) { for (Node child : children) unlockAll((NodeSPI) child, null); } unlock(node.getFqn(), null); }
/** * Pushes the state of a specific node by reading the node's data from the cache and putting in the cache store * via the cache loader. This method is call recursively so that it iterates through the whole cache. * * @param node instance of NodeSPI to push to the cache loader * @throws Exception if there's any issues reading the data from the cache or pushing the node's data to the cache * loader. */ protected void pushState(NodeSPI node) throws Exception { /* Navigates to the children */ Collection<NodeSPI> children = node.getChildren(); if (trace) log.trace("Children for " + node.getFqn() + " are " + children); if (!children.isEmpty()) { for (NodeSPI aChildren : children) { pushState(aChildren); } } Map data = node.getData(); Fqn fqn = node.getFqn(); if (!data.isEmpty()) { put(fqn, data); } }
private void migrateDefunctData(NodeSPI backupRoot, Address dataOwner) { Fqn defunctBackupRootFqn = getDefunctBackupRootFqn(dataOwner); if (log.isDebugEnabled()) log.debug("Migrating defunct data. Backup root is " + backupRoot + ". New backup root is " + defunctBackupRootFqn); if (trace) log.trace("Children of backup root are " + backupRoot.getChildren()); String ownerName = buddyFqnTransformer.getGroupNameFromAddress(dataOwner); Set<DefunctDataHistory> newHistorySet = new ConcurrentHashSet<DefunctDataHistory>(); Set<DefunctDataHistory> historySet = defunctDataHistory.putIfAbsent(ownerName, newHistorySet); if (historySet == null) { historySet = newHistorySet; } DefunctDataHistory history = new DefunctDataHistory(dataOwner, (Integer) defunctBackupRootFqn.getLastElement(), System.currentTimeMillis()); historySet.add(history); for (Object child : backupRoot.getChildren()) { Fqn childFqn = ((Node) child).getFqn(); cache.getInvocationContext().getOptionOverrides().setCacheModeLocal(true); cache.move(childFqn, defunctBackupRootFqn); } history.recordDataMoved(); cache.getInvocationContext().getOptionOverrides().setCacheModeLocal(true); backupRoot.getParentDirect().removeChild(backupRoot.getFqn().getLastElement()); }