private void replace(InvocationContext ctx, Fqn fqn) throws InterruptedException { NodeSPI n = helper.wrapNodeForReading(ctx, fqn, true); if (n instanceof NullMarkerNode) { ctx.getLookedUpNodes().remove(fqn); } n = helper.wrapNodeForWriting(ctx, fqn, true, true, true, false, false); n.setDataLoaded(true); }
/** * Recursively marks a node as removed. * * @param node Node to mark * @param ctx Invocation context */ protected void recursivelyMarkAsRemoved(NodeSPI node, InvocationContext ctx) { node.markAsDeleted(true); Fqn parentFqn = node.getFqn(); // recursion has to happen like this since child nodes are in the ctx. Map<Fqn, NodeSPI> nodes = ctx.getLookedUpNodes(); for (Map.Entry<Fqn, NodeSPI> entry : nodes.entrySet()) { if (entry.getKey().isChildOf(parentFqn)) entry.getValue().markAsDeleted(true); } }
private void restoreInvocationContext(InvocationContext backup) { InvocationContext currentIC = cache.getInvocationContext(); backup.putLookedUpNodes(currentIC.getLookedUpNodes()); cache.setInvocationContext(backup); }
/** * Resets the current (passed-in) invocation, and returns a temp InvocationContext containing its state so it can * be restored later using {@link #restoreInvocationContext(org.jboss.cache.InvocationContext)} * * @param ctx the current context to be reset * @return a clone of ctx, before it was reset */ private InvocationContext resetInvocationContext(InvocationContext ctx) { // wipe current context. cache.setInvocationContext(null); // get a new Invocation Context InvocationContext newContext = cache.getInvocationContext(); newContext.putLookedUpNodes(ctx.getLookedUpNodes()); return ctx; }
for (Map.Entry<Fqn, NodeSPI> n : ctx.getLookedUpNodes().entrySet())
if (n instanceof NullMarkerNode) ctx.getLookedUpNodes().remove(fqn); n = null;