Examples of NodeSPI


Examples of org.jboss.cache.NodeSPI

      private void handlePutCommand(InvocationContext ctx, Fqn fqn)
            throws Exception
      {
         if (fqn != null && dataContainer.peek(fqn, false, false) != null && loader.exists(fqn))
         {
            NodeSPI n = dataContainer.peek(fqn, true, false);// don't load
            // node not null and attributes have been loaded?
            if (n != null && n.isDataLoaded())
            {
               // has children?
               boolean result = childrenLoaded(n);
               if (!n.getChildrenDirect().isEmpty() && result)
               {
                  // children have been loaded, remove the node
                  addRemoveMod(ctx, cacheLoaderModifications, fqn, n.getDataDirect());
                  txActs++;
               }
               // doesn't have children, check the cache loader
               else if (loaderNoChildren(fqn))
               {
                  addRemoveMod(ctx, cacheLoaderModifications, fqn, n.getDataDirect());
                  txActs++;
               }
            }
         }
      }
View Full Code Here

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

Examples of org.jboss.cache.NodeSPI

      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

Examples of org.jboss.cache.NodeSPI

    * @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

Examples of org.jboss.cache.NodeSPI

    *
    * @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

Examples of org.jboss.cache.NodeSPI

    *
    * @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

Examples of org.jboss.cache.NodeSPI

   }

   @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

Examples of org.jboss.cache.NodeSPI

   }

   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

Examples of org.jboss.cache.NodeSPI

   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

Examples of org.jboss.cache.NodeSPI

   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
TOP
Copyright © 2018 www.massapi.com. 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.