Package org.jboss.cache

Examples of org.jboss.cache.NodeSPI


      assertTrue("Data should be loaded for node " + f, cache.peek(f, false).isDataLoaded());
   }

   protected void assertDataNotLoaded(Fqn f)
   {
      NodeSPI n = cache.peek(f, true);
      assertFalse("Data should not be loaded for node " + f, n != null && n.isDataLoaded());
   }
View Full Code Here


      NodeSpiMock secondDeadNode = (NodeSpiMock) root.addChildDirect(fqnTransformer.getDeadBackupRoot(secondAddress));
      secondDeadNode.addChildDirect(Fqn.fromElements(0));


      expect(spiMock.getNode(fqn)).andReturn(null);
      NodeSPI buddyBackupRoot = (NodeSPI) root.getChild(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN);
      expect(containerMock.peek(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN)).andReturn(buddyBackupRoot);

      control.checkOrder(false);
      expect(spiMock.getChildrenNames(firstDeadNode.getFqn())).andReturn(firstDeadNode.getChildrenNames());
      Object fqnElement = fqn.getLastElement();//this is only composed from one element
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

   }


   public void testAcquireAll() throws Exception
   {
      NodeSPI root;
      Object owner = Thread.currentThread();

      cache = createCache(Configuration.CacheMode.LOCAL, IsolationLevel.SERIALIZABLE);
      cache.put("/a/b/c", null);
      cache.put("/1/2/3", null);

      root = cache.getRoot();
      NodeLock lock = root.getLock();

      lock.acquireAll(owner, 2000, LockType.READ);
      lock.releaseAll(owner);

      assertEquals(0, cache.getNumberOfLocksHeld());
View Full Code Here

   }


   public void testAcquireAllReplicated() throws Exception
   {
      NodeSPI root;
      Object owner = Thread.currentThread();

      cache2 = createCache(Configuration.CacheMode.REPL_ASYNC, IsolationLevel.SERIALIZABLE);
      cache2.put("/a/b/c", null);
      cache2.put("/1/2/3", null);

      cache = createCache(Configuration.CacheMode.REPL_ASYNC, IsolationLevel.SERIALIZABLE);
      root = cache.getRoot();
      NodeLock lock = root.getLock();

      lock.acquireAll(owner, 2000, LockType.READ);
      lock.releaseAll(owner);

      assertEquals(0, cache.getNumberOfLocksHeld());
View Full Code Here

   {
      if (cache.getCacheStatus() == CacheStatus.STARTING)
      {
         // Before calling the nested cache loader we first check if the data exists in the local cache
         // in order to prevent multiple call to the cache store                 
         NodeSPI node = cache.peek(name, false);
         if (node != null)
         {
            // The node already exists in the local cache, so we return the corresponding data
            return node.getDataDirect();
         }
         else
         {
            // The node doesn't exist in the local cache, so we need to check through the nested
            // cache loader           
View Full Code Here

   {
      if (cache.getCacheStatus() == CacheStatus.STARTING)
      {
         // Before calling the nested cache loader we first check if the data exists in the local cache
         // in order to prevent multiple call to the cache store                 
         NodeSPI node = cache.peek(name, false);
         if (node != null)
         {
            // The node already exists in the local cache, so we return the corresponding data
            return node.getDataDirect();
         }
         else
         {
            // The node doesn't exist in the local cache, so we need to check through the nested
            // cache loader           
View Full Code Here

            // ${ws-id}/$CHILD_NODES_BY_PATTERN_LIST/${node-id}/${pattern-QPathEntry} or
            // ${ws-id}/$CHILD_PROPS_BY_PATTERN_LIST/${node-id}/${pattern-QPathEntry}

            // We use the method hasChildrenDirect to avoid going through
            // the intercepter chain (EXOJCR-460)
            NodeSPI node = ((CacheSPI)cache).peek(parentFqn, false);
            // Check if not null, possibly this node was concurrently removed
            if (node != null && !node.hasChildrenDirect())
            {
               if (LOG.isTraceEnabled())
               {
                  LOG.trace("Evicting Fqn " + parentFqn);
               }
View Full Code Here

   {
      if (cache.getCacheStatus() == CacheStatus.STARTING)
      {
         // Before calling the nested cache loader we first check if the data exists in the local cache
         // in order to prevent multiple call to the cache store                 
         NodeSPI node = cache.peek(name, false);
         if (node != null)
         {
            // The node already exists in the local cache, so we return the corresponding data
            return node.getDataDirect();
         }
         else
         {
            // The node doesn't exist in the local cache, so we need to check through the nested
            // cache loader           
View Full Code Here

      return invokeNextInterceptor(ctx, command);
   }

   private void replace(InvocationContext ctx, Fqn fqn) throws InterruptedException
   {
      NodeSPI n = helper.wrapNodeForReading(ctx, fqn, true);
      if (n instanceof NullMarkerNode)
      {
         ctx.getLookedUpNodes().remove(fqn);
      }
      n = helper.wrapNodeForWriting(ctx, fqn, true, true, true, false, false);
      n.setDataLoaded(true);
   }
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.