public boolean lockAll(NodeSPI node, LockType lockType, Object owner) throws InterruptedException { if (lockType == READ) return true; // we don't support read locks. return lockRecursively(node.getDelegationTarget(), lockAcquisitionTimeout, false, null); }
public boolean lockAll(NodeSPI node, LockType lockType, Object owner, long timeout) throws InterruptedException { if (lockType == READ) return true; // we don't support read locks. return lockRecursively(node.getDelegationTarget(), timeout, false, null); }
public boolean lockAll(NodeSPI node, LockType lockType, Object owner, long timeout, boolean excludeInternalFqns) throws InterruptedException { if (lockType == READ) return true; // we don't support read locks. return lockRecursively(node.getDelegationTarget(), timeout, excludeInternalFqns, null); }
/** * Sets the root node reference to the node passed in. * * @param root node */ public void setRoot(Object root) { if (root == null) throw new CacheException("Attempting to set a null node as a root node!"); // Mega-Ugh! if (usingMvcc && root instanceof InternalNode) { if (log.isDebugEnabled()) log.debug("Setting rootInternal to " + root); rootInternal = (InternalNode) root; this.root = null; } else { this.root = (NodeSPI) root; if (usingMvcc) { if (log.isDebugEnabled()) log.debug("Setting rootInternal to " + this.root.getDelegationTarget()); rootInternal = this.root.getDelegationTarget(); this.root = null; } } }
public void createRootNode() { usingMvcc = config != null && config.getNodeLockingScheme() == NodeLockingScheme.MVCC; if (trace) log.trace("Starting data container. Using MVCC? " + usingMvcc); // create a new root temporarily. NodeSPI tempRoot = nodeFactory.createRootNode(); // if we don't already have a root or the new (temp) root is of a different class (optimistic vs pessimistic) to // the current root, then we use the new one. Class currentRootType = root == null ? null : root.getDelegationTarget().getClass(); Class tempRootType = tempRoot.getDelegationTarget().getClass(); if (!tempRootType.equals(currentRootType)) { if (trace) log.trace("Setting root node to an instance of " + tempRootType); setRoot(tempRoot); } if (usingMvcc && rootInternal == null) setRoot(root); // sets the "internal root" }
public boolean lockAllAndRecord(NodeSPI node, LockType lockType, InvocationContext ctx) throws InterruptedException { if (lockType == READ) return true; // we don't support read locks. return lockRecursively(node.getDelegationTarget(), ctx.getLockAcquisitionTimeout(lockAcquisitionTimeout), false, ctx); }
integrator.integrateState(state, targetRoot.getDelegationTarget(), targetRoot.getFqn(), fetchPersistentState);
public List<NodeData> buildNodeData(List<NodeData> list, NodeSPI node, boolean mapSafe) { if (usingMvcc) { return buildNodeData(list, node.getDelegationTarget(), node.getData(), mapSafe); } else { return buildNodeDataLegacy(list, node, mapSafe); } }
protected void storeStateForPutDataMap(Fqn f, InvocationContext ctx) throws Exception { loader.put(f, ctx.lookUpNode(f).getDelegationTarget().getData()); }
@SuppressWarnings("unchecked") private void moveRecursively(NodeSPI oldNode, NodeSPI newNode, InvocationContext ctx) { if (trace) log.trace("Moving " + oldNode.getFqn() + " to " + newNode.getFqn()); // start deep. Map<Object, InternalNode> children = oldNode.getDelegationTarget().getChildrenMap(); if (!children.isEmpty()) { for (InternalNode child : children.values()) { Fqn childFqn = child.getFqn(); Fqn newChildFqn = childFqn.replaceAncestor(oldNode.getFqn(), newNode.getFqn()); moveRecursively(ctx.lookUpNode(childFqn), ctx.lookUpNode(newChildFqn), ctx); } } // now swap the data for the current node. newNode.getDelegationTarget().putAll(oldNode.getDelegationTarget().getData()); oldNode.markAsDeleted(true); }
removeLocksForDeadMembers(root.getDelegationTarget(), removed);
retval = parent.getDelegationTarget();
private void integrateRetainedNode(Fqn ancFqn, Fqn descFqn) InternalNode ancestor = cache.getNode(ancFqn).getDelegationTarget(); Object name = descFqn.get(ancFqn.size()); InternalNode child = ancestor.getChild(name); InternalNode descendant = cache.getNode(descFqn).getDelegationTarget(); prepareContextOptions(); ancestor.addChild(name, descendant);
InternalNode subtreeRoot = fqn.isRoot() ? cache.getRoot().getDelegationTarget() : cache.getNode(fqn).getDelegationTarget();
PessimisticUnversionedNode parentInternalNode = (PessimisticUnversionedNode) parent.getDelegationTarget(); currentNode = parentInternalNode.addChildAndAcquireLock(childName, !skipNotification, new LockAcquirer(ctx, WRITE, timeout, owner)); skipLockAcquire = true;
private ReadCommittedNode createAbsentNode(Fqn parentFqn, Fqn fqn, InvocationContext context) throws InterruptedException { parentFqn = fqn.getParent(); NodeSPI parent = wrapNodeForWriting(context, parentFqn, false, true, false, false, false); // do we need to lock the parent to create children? boolean parentLockNeeded = isParentLockNeeded(parent.getDelegationTarget()); // get a lock on the parent. if (parentLockNeeded && acquireLock(context, parentFqn)) { ReadCommittedNode parentRCN = (ReadCommittedNode) context.lookUpNode(parentFqn); parentRCN.markForUpdate(dataContainer, writeSkewCheck); } // now to lock and create the node. Lock first to prevent concurrent creation! acquireLock(context, fqn); InternalNode in = nodeFactory.createChildNode(fqn, null, context, false); ReadCommittedNode n = nodeFactory.createWrappedNode(in, parent.getDelegationTarget()); n.setCreated(true); n.setDataLoaded(true); // created here so we are loading it here context.putLookedUpNode(fqn, n); n.markForUpdate(dataContainer, writeSkewCheck); return n; }
node = temp.getDelegationTarget(); loadChildren(child.getFqn(), child.getDelegationTarget(), true, isMove, ctxt);
node.markAsDeleted(true); node.setDataLoaded(false); node.getDelegationTarget().clear(); return true;
loadChildren(fqn, n.getDelegationTarget(), recursive, isMove, ctx);