private void removeDataLegacy(Fqn fqn) { NodeSPI n = peek(fqn); if (n == null) { log.warn("node " + fqn + " not found"); return; } n.clearDataDirect(); n.setDataLoaded(false); }
public void rollback() { if (trace) log.trace("rollback(" + globalTransaction + ", " + fqn + ", " + data + ")"); NodeSPI n = dataContainer.peek(fqn, false, true); if (n != null) { n.clearDataDirect(); if (oldData != null) n.putAllDirect(oldData); } } }
protected void removeData(NodeSPI n, InvocationContext ctx) throws CacheException { notifier.notifyNodeInvalidated(fqn, true, ctx); n.clearDataDirect(); n.setDataLoaded(false); notifier.notifyNodeInvalidated(fqn, false, ctx); }
/** * Clears the data map in the node referenced by the specified Fqn. * * @param ctx invocation context * @return null */ public Object perform(InvocationContext ctx) { if (trace) log.trace("perform(" + globalTransaction + ", \"" + fqn + "\")"); NodeSPI targetNode = peekVersioned(ctx); if (targetNode == null) { if (log.isDebugEnabled()) log.debug("node " + fqn + " not found"); return null; } Map data = targetNode.getDataDirect(); notifier.notifyNodeModified(fqn, true, NodeModifiedEvent.ModificationType.REMOVE_DATA, data, ctx); targetNode.clearDataDirect(); notifier.notifyNodeModified(fqn, false, NodeModifiedEvent.ModificationType.REMOVE_DATA, data, ctx); return null; }
protected void integrateTransientState(ObjectInputStream in, NodeSPI target) throws Exception { boolean transientSet = false; try { if (log.isTraceEnabled()) { log.trace("integrating transient state for " + target); } integrateTransientState(target, in); transientSet = true; if (log.isTraceEnabled()) { log.trace("transient state successfully integrated"); } notifyAllNodesCreated(cache.getInvocationContext(), target); } catch (Exception e) { throw new CacheException(e); } finally { if (!transientSet) { target.clearDataDirect(); target.removeChildrenDirect(); } } }
@Stop(priority = 100) public void stop() { started = false; // empty in-memory state if (root != null) { root.clearDataDirect(); root.removeChildrenDirect(); } else if (rootInternal != null) { rootInternal.clear(); rootInternal.removeChildren(); } }
public void rollback() { if (targetNode != null) { Object childName = targetNode.getFqn().getLastElement(); if (trace) { log.trace("rollback(parent: " + parentFqn + ", child: " + childName + ", node=" + targetNode + ")"); } if (parentFqn == null || childName == null) { log.error("parent fqn or childName or childNode was null"); return; } NodeSPI parentNode = dataContainer.peek(parentFqn); if (parentNode == null) { log.warn("node " + parentFqn + " not found"); return; } parentNode.addChild(childName, targetNode); targetNode.markAsDeleted(false, true); targetNode.clearDataDirect(); if (originalData != null) targetNode.putAllDirect(originalData); targetNode.setValid(true, true); } } }
/** * Removes the node referenced by the specified Fqn. */ public Object perform(InvocationContext ctx) { if (trace) log.trace("perform(" + globalTransaction + ", " + fqn + ")"); // Find the node targetNode = peekVersioned(ctx); if (targetNode == null || targetNode.isDeleted()) { if (trace) log.trace("node " + fqn + " not found"); return false; } notifyBeforeRemove(targetNode, ctx); boolean found = targetNode.isValid() && !targetNode.isDeleted(); recursivelyMarkAsRemoved(targetNode, ctx); // make sure we clear all data on this node! targetNode.clearDataDirect(); notifyAfterRemove(ctx); return found; }
/** * Test if this node needs to be 'undeleted' * reverse the "remove" if the node has been previously removed in the same tx, if this operation is a put() */ public static void manageReverseRemove(InvocationContext ctx, NodeSPI childNode, boolean reverseRemoveCheck, List createdNodes, CommandsFactory commandsFactory) { if (ctx.getGlobalTransaction() != null) //if no tx then reverse remove does not make sense { Fqn fqn = childNode.getFqn(); TransactionContext transactionContext = ctx.getTransactionContext(); boolean needToReverseRemove = reverseRemoveCheck && childNode.isDeleted() && transactionContext != null && transactionContext.getRemovedNodes().contains(fqn); if (!needToReverseRemove) return; childNode.markAsDeleted(false); //if we'll rollback the tx data should be added to the node again Map oldData = new HashMap(childNode.getDataDirect()); PutDataMapCommand command = commandsFactory.buildPutDataMapCommand(ctx.getGlobalTransaction(), fqn, oldData); // txTable.get(gtx).addUndoOperation(command); --- now need to make sure this is added to the normal mods list instead transactionContext.addModification(command); //we're prepared for rollback, now reset the node childNode.clearDataDirect(); if (createdNodes != null) { createdNodes.add(childNode); } } } }
node.clearDataDirect(); node.setDataLoaded(false); return false;
node.clearDataDirect(); node.setDataLoaded(false); return false;
underlyingNode.clearDataDirect(); underlyingNode.putAllDirect(mergedData);