Package org.jboss.cache

Examples of org.jboss.cache.NodeSPI


   }

   public void setState(ObjectInputStream in, Fqn targetRoot) throws Exception
   {
      cache.getInvocationContext().getOptionOverrides().setSkipCacheStatusCheck(true);
      NodeSPI target = cache.getNode(targetRoot);
      if (target == null)
      {
         // Create the integration root, but do not replicate
         cache.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
View Full Code Here


   }

   private void integrateTransientState(Fqn target, ObjectInputStream in) throws Exception
   {
      prepareContextOptions();
      NodeSPI targetNode = cache.getNode(target);
      for (Object childname : targetNode.getChildrenNames())
      {
         prepareContextOptions();
         targetNode.removeChild(childname);
      }

      List<NodeData> list = readNodesAsList(in);
      if (list != null)
      {
View Full Code Here

      TransactionWorkspace w = getTransactionWorkspace(ctx);
      Map nodeMap = w.getNodes();
      for (Iterator i = nodeMap.keySet().iterator(); i.hasNext();)
      {
         WorkspaceNode wn = (WorkspaceNode) nodeMap.get(i.next());
         NodeSPI n = wn.getNode();
         NodeLock lock = n.getLock();
         if (lock.isLocked())
         {
            actual.put(n.getFqn(), lock.isReadLocked() ? READ : WRITE);
         }
      }
      return invokeNextInterceptor(ctx, command);
   }
View Full Code Here

   }

   public void testLockReentrancy() throws InterruptedException
   {
      Fqn fqn = Fqn.fromString("/a/b/c");
      NodeSPI node = new NodeInvocationDelegate(new UnversionedNode(fqn));

      assert lm.lock(fqn, WRITE, null);
      assert lm.isLocked(node);

      assert lm.lock(node, WRITE, null);
View Full Code Here

            return false;
         }
         else
         {
            if (trace) log.trace("removing NODE as it is a leaf: evict(" + fqn + ")");
            NodeSPI parentNode = lookupForEviction(ctx, fqn.getParent());

            if (parentNode != null)
            {
               parentNode.removeChildDirect(fqn.getLastElement());
               parentNode.setChildrenLoaded(false);
            }
            node.setValid(false, false);
            node.markAsDeleted(true);
            return true;
         }
View Full Code Here

   private void move(Fqn toMoveFqn, Fqn newParentFqn, boolean skipNotifications, InvocationContext ctx)
   {
      // the actual move algorithm.
      // ctx *could* be null if this is a rollback!!!  Sucks big time.
      NodeSPI newParent = ctx == null ? dataContainer.peek(newParentFqn) : ctx.lookUpNode(newParentFqn);
      if (newParent == null || newParent.isDeleted())
      {
         throw new NodeNotExistsException("New parent node " + newParentFqn + " does not exist when attempting to move node!!");
      }

      // ctx *could* be null if this is a rollback!!!  Sucks big time.
      NodeSPI node = ctx == null ? dataContainer.peek(toMoveFqn) : ctx.lookUpNode(toMoveFqn);

      if (node == null || node.isDeleted())
      {
         throw new NodeNotExistsException("Node " + toMoveFqn + " does not exist when attempting to move node!!");
      }

      if (trace) log.trace("Moving " + fqn + " to sit under " + to);

      NodeSPI oldParent = node.getParentDirect();
      Object nodeName = toMoveFqn.getLastElement();

      // now that we have the parent and target nodes:
      // first correct the pointers at the pruning point
      oldParent.removeChildDirect(nodeName);
      newParent.addChild(nodeName, node);
      // parent pointer is calculated on the fly using Fqns.

      // notify
      if (!skipNotifications)
View Full Code Here

    */
   @Override
   @SuppressWarnings("unchecked")
   protected Set<Object> getBackupRoots()
   {
      NodeSPI backupSubtree = dataContainer.peek(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN);
      if (backupSubtree == null) return null;
      return backupSubtree.getChildrenNamesDirect();
   }
View Full Code Here

   }

   @Override
   public Object perform(InvocationContext ctx)
   {
      NodeSPI targetNode = peekVersioned(ctx);
      if (targetNode != null)
      {
         Map data = targetNode.getDataDirect();
         if (data != null && !data.isEmpty()) originalData = new HashMap(data);
      }
      boolean found = (Boolean) super.perform(ctx);

      // now record rollback info.
      if (globalTransaction != null && found)
      {
         NodeSPI parentNode = targetNode.getParentDirect();
         prepareForRollback(parentNode);
      }
      return found;
   }
View Full Code Here

         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);
      }
View Full Code Here

    *
    * @return true if the node was removed from the tree or if it is resident.  Returns false if the node still exists; i.e. was only data removed because it still has children.
    */
   public Object perform(InvocationContext ctx)
   {
      NodeSPI node = lookupForEviction(ctx, fqn);
      if (node == null || node.isDeleted())
      {
         return false;
      }
      else if (node.isResident())
      {
         return true;
      }
      else if (recursive)
      {
View Full Code Here

TOP

Related Classes of org.jboss.cache.NodeSPI

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.