Package org.jboss.cache

Examples of org.jboss.cache.NodeSPI


    * @param ctx invocation context
    * @return a Node, or null if the Fqn refers to a node that does not exist.
    */
   public Object perform(InvocationContext ctx)
   {
      NodeSPI node = ctx.lookUpNode(fqn);
      if (node != null && node.isDeleted())
      {
         if (trace)
            log.trace("Node of type [" + node.getClass().getSimpleName() + "] found but marked as deleted in current scope.  Returning null.");
         return null;
      }
      if (trace) log.trace("Found node, returning " + node);
      return node;
   }
View Full Code Here


      Set<Object> childNames = new HashSet<Object>();

      for (InternalNode realChild : children)
      {
         Fqn childFqn = realChild.getFqn();
         NodeSPI childNode = ctx.lookUpNode(childFqn);

         // deletion flag should be checked on what we get from the ctx.
         // if childNode is null then it hasn't been removed in the current scope and hence should be included in this list.
         if (childNode == null || !childNode.isDeleted()) childNames.add(childFqn.getLastElement());
      }

      // now check for any *new* children added.
      for (Map.Entry<Fqn, NodeSPI> n : ctx.getLookedUpNodes().entrySet())
      {
         Fqn childFqn = n.getKey();

         if (childFqn.isDirectChildOf(fqn))
         {
            ReadCommittedNode childNode = (ReadCommittedNode) n.getValue();
            if (childNode.isCreated()) childNames.add(childFqn.getLastElement());
         }
      }
      return childNames;
   }
View Full Code Here

    * @param ctx invocation context
    * @return a Set<K> of data keys contained in a node for a given Fqn, or null if the Fqn refers to a node that does not exist.
    */
   public Object perform(InvocationContext ctx)
   {
      NodeSPI n = ctx.lookUpNode(fqn);
      if (n == null || n.isDeleted()) return null;
      return n.getKeysDirect();
   }
View Full Code Here

    *
    * @return an Object of type V, stored under a specific key in a node for a given Fqn, or null if the Fqn refers to a node that does not exist.
    */
   public Object perform(InvocationContext ctx)
   {
      NodeSPI n = ctx.lookUpNode(fqn);
      if (n == null)
      {
         if (trace) log.trace("Node not found");
         return null;
      }
      if (n.isDeleted())
      {
         if (trace) log.trace("Node has been deleted and is of type " + n.getClass().getSimpleName());
         return null;
      }
      if (sendNodeEvent) notifier.notifyNodeVisited(fqn, true, ctx);
      Object result = n.getDirect(key);
      if (trace) log.trace("Found value " + result);
      if (sendNodeEvent) notifier.notifyNodeVisited(fqn, false, ctx);
      return result;
   }
View Full Code Here

    *
    * @return true if the node exists, false otherwise.
    */
   public Object perform(InvocationContext ctx)
   {
      NodeSPI node = ctx.lookUpNode(fqn);
      return node != null && !node.isDeleted();
   }
View Full Code Here

   }

   @Override
   public Object perform(InvocationContext ctx)
   {
      NodeSPI node = enforceNodeLoading();
      if (trace) log.trace("Invalidating fqn:" + fqn);
      if (node == null)
      {
         // check if a tombstone already exists
         NodeSPI nodeSPI = dataContainer.peek(fqn, true, true);
         if (nodeSPI == null)
         {
            if (dataVersion == null)
            {
               if (trace)
View Full Code Here

   }

   private void dumpVersionInfo(CacheSPI c1, CacheSPI c2, Fqn fqn)
   {
      System.out.println("**** Versin Info for Fqn [" + fqn + "] ****");
      NodeSPI n1 = c1.getRoot().getChildDirect(fqn);
      System.out.println("  Cache 1: " + n1.getVersion() + " dataLoaded? " + n1.isDataLoaded());

      NodeSPI n2 = c2.getRoot().getChildDirect(fqn);
      System.out.println("  Cache 2: " + n2.getVersion() + " dataLoaded? " + n2.isDataLoaded());
   }
View Full Code Here

   public void testRecordingLocksNoTx() throws InterruptedException
   {
      AbstractLockManagerRecordingTestTL tl = threadLocal.get();
      LockManager lm = tl.lm;
      Fqn fqn = Fqn.fromString("/a/b/c");
      NodeSPI node = createNode(fqn);
      InvocationContext ctx = tl.icc.get();

      // lock and record.
      lm.lockAndRecord(node, WRITE, ctx);
      assert ctx.getLocks().contains(fqnBasedLocking ? fqn : node.getLock());
      assert ctx.getLocks().size() == 1;
      assert lm.isLocked(node) : "Should be locked";
      lm.unlock(ctx);
      assert !lm.isLocked(node) : "Should not be locked";
   }
View Full Code Here

   public void testRecordingLocksWithTx() throws InterruptedException, SystemException, RollbackException
   {
      AbstractLockManagerRecordingTestTL tl = threadLocal.get();
      LockManager lm = tl.lm;
      Fqn fqn = Fqn.fromString("/a/b/c");
      NodeSPI node = createNode(fqn);
      InvocationContext ctx = tl.icc.get();
      ctx.setGlobalTransaction(new GlobalTransaction());
      ctx.setTransaction(new DummyTransaction(DummyTransactionManager.getInstance()));
      ctx.setTransactionContext(tl.contextFactory.createTransactionContext(ctx.getTransaction()));

      // lock and record.
      lm.lockAndRecord(node, WRITE, ctx);
      assert ctx.getLocks().contains(fqnBasedLocking ? fqn : node.getLock());
      assert ctx.getTransactionContext().getLocks().size() == 1;
      assert lm.isLocked(node) : "Should be locked";
      lm.unlock(ctx);
      assert !lm.isLocked(node) : "Should not be locked";
   }
View Full Code Here

            for (Address a : toRemove)
            {
               BuddyGroup bg = buddyGroupsIParticipateIn.remove(a);
               Fqn backupRootFqn = buddyFqnTransformer.getBackupRoot(bg.getDataOwner());
               NodeSPI backupRoot = cache.getNode(backupRootFqn);
               if (backupRoot != null)
               {
                  // could be a race condition where the backup region has been removed because we have been removed
                  // from the buddy group, but the buddyGroupsIParticipateIn map hasn't been updated.
                  migrateDefunctData(backupRoot, bg.getDataOwner());
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.