public final Set<InternalNode<K, V>> getChildren() { return delegate.getChildren(); }
public final Set<InternalNode<K, V>> getChildren(boolean includeMarkedForRemoval) { return delegate.getChildren(includeMarkedForRemoval); }
private int numNodesMvcc(InternalNode node) { int count = 1; //for 'node' if (node != null) { Set<InternalNode> children = node.getChildren(); for (InternalNode child : children) { count += numNodesMvcc(child); } } return count; }
private int numAttributes(InternalNode n) { int count = 0; for (Object child : n.getChildren()) { count += numAttributes((NodeSPI) child); } count += n.getData().size(); return count; }
private int numAttributesMvcc(InternalNode n) { int count = 0; for (Object child : n.getChildren()) { count += numAttributesMvcc((InternalNode) child); } count += n.getData().size(); return count; }
private void recursiveAddEvictionNodes(InternalNode<?, ?> node, List<Fqn> result) { for (InternalNode child : node.getChildren()) { recursiveAddEvictionNodes(child, result); } Fqn fqn = node.getFqn(); if (!fqn.isRoot() && !node.isResident()) { result.add(fqn); } }
/** * Only used with MVCC. */ private void removeLocksForDeadMembers(InternalNode<?, ?> node, List deadMembers) { Set<GlobalTransaction> deadOwners = new HashSet<GlobalTransaction>(); Object owner = lockManager.getWriteOwner(node.getFqn()); if (isLockOwnerDead(owner, deadMembers)) deadOwners.add((GlobalTransaction) owner); // MVCC won't have any read locks. for (GlobalTransaction deadOwner : deadOwners) { boolean localTx = deadOwner.getAddress().equals(getLocalAddress()); boolean broken = LockUtil.breakTransactionLock(node.getFqn(), lockManager, deadOwner, localTx, txTable, txManager); if (broken && trace) log.trace("Broke lock for node " + node.getFqn() + " held by " + deadOwner); } // Recursively unlock children for (InternalNode child : node.getChildren()) removeLocksForDeadMembers(child, deadMembers); }
protected void generateNodeDataList(InternalNode<?, ?> node, List<NodeData> list) throws Exception { if (internalFqns.contains(node.getFqn())) { return; } Map attrs; NodeData nd; // first handle the current node attrs = node.getInternalState(false); if (attrs.size() == 0) { nd = new NodeData(node.getFqn()); } else { nd = new NodeData(node.getFqn(), attrs, true); } list.add(nd); // then visit the children for (InternalNode child : node.getChildren()) generateNodeDataList(child, list); } }
private boolean childrenLoaded(InternalNode<?, ?> node) throws Exception { if (!node.isChildrenLoaded() && loader.getChildrenNames(node.getFqn()) != null) return false; for (InternalNode child : node.getChildren()) { if (!child.isDataLoaded()) { return false; } if (child.hasChildren()) { if (!childrenLoaded(child)) { return false; } } else if (!loaderNoChildren(child.getFqn())) { return false; } } return true; }
/** * Generates NodeAdded notifications for all nodes of the tree. This is * called whenever the tree is initially retrieved (state transfer) */ private void notifyAllNodesCreated(InvocationContext ctx, InternalNode curr) { if (curr == null) return; ctx.setOriginLocal(false); cache.getNotifier().notifyNodeCreated(curr.getFqn(), true, ctx); cache.getNotifier().notifyNodeCreated(curr.getFqn(), false, ctx); // AND notify that they have been modified!! if (!curr.getKeys().isEmpty()) { cache.getNotifier().notifyNodeModified(curr.getFqn(), true, NodeModifiedEvent.ModificationType.PUT_MAP, Collections.emptyMap(), ctx); cache.getNotifier().notifyNodeModified(curr.getFqn(), false, NodeModifiedEvent.ModificationType.PUT_MAP, curr.getData(), ctx); } ctx.setOriginLocal(true); Set<InternalNode> children = curr.getChildren(); for (InternalNode n : children) notifyAllNodesCreated(ctx, n); }