Package org.jboss.cache

Examples of org.jboss.cache.InternalNode


   // TODO: What is this rubbish?!??
   private void integrateRetainedNode(Fqn ancFqn, Fqn descFqn)
   {
      prepareContextOptions();
      InternalNode ancestor = cache.getNode(ancFqn).getDelegationTarget();
      Object name = descFqn.get(ancFqn.size());
      InternalNode child = ancestor.getChild(name);
      if (ancFqn.size() == descFqn.size() + 1)
      {
         if (child == null)
         {
            prepareContextOptions();
            InternalNode descendant = cache.getNode(descFqn).getDelegationTarget();
            prepareContextOptions();
            ancestor.addChild(name, descendant);
         }
         else
         {
View Full Code Here


      setFlag(CHANGED);

      if (writeSkewCheck)
      {
         // check for write skew.
         InternalNode underlyingNode = container.peekInternalNode(fqn, true);

         if (underlyingNode != null && underlyingNode != node)
         {
            String errormsg = new StringBuilder().append("Detected write skew on Fqn [").append(fqn).append("].  Another process has changed the node since we last read it!").toString();
            if (log.isWarnEnabled()) log.warn(errormsg + ".  Unable to copy node for update.");
View Full Code Here

      {
         dataContainer.setRoot(node);
      }
      else if (!isFlagSet(DELETED))
      {
         InternalNode parent = lookupParent(fqn, ctx, dataContainer);
         parent.addChild(node, true)// we know this is safe since we calculated the parent from the child.  No need to have the parent re-do checks when adding the child again.
      }
   }
View Full Code Here

      setFlag(CHANGED)// mark as changed
      if (!isFlagSet(CREATED)) // if newly created, then nothing to copy.
      {
         backup = node;
         // don't copy the NodeReference but the InternalNode that the NodeReference delegates to.
         InternalNode backupDelegationTarget = ((NodeReference) backup).getDelegate();
         node = backupDelegationTarget.copy();
      }
   }
View Full Code Here

         // check if node has been deleted.
         if (isFlagSet(DELETED))
         {
            if (!fqn.isRoot())
            {
               InternalNode parent = lookupParent(fqn, ctx, container);
               parent.removeChild(fqn.getLastElement());
               setValid(false, false);
               updateNode(fqn, ctx, container);
            }
            else
            {
               // should never get here.  Other layers should prevent a delete on root.
               log.warn("Attempting to remove the root node.  Not doing anything!");
            }
         }
         else if (isFlagSet(CREATED))
         {
            // add newly created nodes to parents.
            InternalNode parent = lookupParent(fqn, ctx, container);
            parent.addChild(node, true); // we know this is safe since we calculated the parent from the child.  No need to have the parent re-do checks when adding the child again.
         }
         else
         {
            // Only content has been updated, just update refs.
            updateNode(fqn, ctx, container);
View Full Code Here

    */
   protected final InternalNode lookupParent(Fqn fqn, InvocationContext ctx, DataContainer container) throws NodeNotExistsException
   {
      if (parent != null) return parent;

      InternalNode retval;
      Fqn parentFqn = fqn.getParent();
      NodeSPI parent = ctx.lookUpNode(parentFqn);
      // first check if the parent is cached in the context.
      if (parent != null)
      {
View Full Code Here

            wrapNodeForWriting(context, fqn.getParent(), true, true, includeInvalidNodes, false, force);
         }
      } else {
         // else, fetch from dataContainer.
         InternalNode[] nodes = dataContainer.peekInternalNodeAndDirectParent(fqn, includeInvalidNodes);
         InternalNode in = nodes[0];
         if (in != null) {
            // exists in cache!  Just acquire lock if needed, and wrap.
            // do we need a lock?
            boolean needToCopy = false;
            if (lockForWriting && acquireLock(context, fqn)) {
View Full Code Here

         return Collections.emptyList();
      } else {
         // update child ref on parent to point to child as this is now a copy.
         if (parentLockNeeded && (needToCopyNode || needToCopyParent)) {
            if (parent == null) throw new NodeNotExistsException("Parent node " + parentFqn + " does not exist!");
            InternalNode ref = null;
            if (configuration.getIsolationLevel() == IsolationLevel.READ_COMMITTED)
            {
               ref = new NodeReference(node.getDelegationTarget());
            }
            else
View Full Code Here

    * @param ctx    invocation context
    * @return true if parent lock is needed, false otherwise.
    */
   private boolean isParentLockNeeded(Fqn parent, InvocationContext ctx) {
      ReadCommittedNode parentNodeTmp = (ReadCommittedNode) ctx.lookUpNode(parent);
      InternalNode in = parentNodeTmp == null ? dataContainer.peekInternalNode(parent, true) : parentNodeTmp.getDelegationTarget();
      return isParentLockNeeded(in);
   }
View Full Code Here

            wrapNodeForWriting(context, fqn.getParent(), true, true, includeInvalidNodes, false, force);
         }
      } else {
         // else, fetch from dataContainer.
         InternalNode[] nodes = dataContainer.peekInternalNodeAndDirectParent(fqn, includeInvalidNodes);
         InternalNode in = nodes[0];
         if (in != null) {
            // exists in cache!  Just acquire lock if needed, and wrap.
            // do we need a lock?
            boolean needToCopy = false;
            if (lockForWriting && acquireLock(context, fqn)) {
View Full Code Here

TOP

Related Classes of org.jboss.cache.InternalNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.