Package org.jboss.cache

Examples of org.jboss.cache.Node


      // now make sure cache2 is in sync with cache1:
      cache2.put(fqn, "key", "value");

      // since the node already exists even PL will not remove it - but will invalidate it's data
      Node n = cache1.getNode(fqn);
      assertHasBeenInvalidated(n, "Should have been invalidated");
      assertEquals("value", cache2.get(fqn, "key"));

      // now test the invalidation:
      cache1.put(fqn, "key2", "value2");
View Full Code Here


      cache2.put(fqn, "key", "value");
//      TestingUtil.sleepThread(500);// give it time to broadcast the evict call
      replListener1.waitForReplicationToOccur(500);

      // since the node already exists even PL will not remove it - but will invalidate it's data
      Node n = cache1.getNode(fqn);
      assertHasBeenInvalidated(n, "Should have been invalidated");
      assertEquals("value", cache2.get(fqn, "key"));

      replListener2.expectAny();
      // now test the invalidation:
View Full Code Here

      cache2.put(fqn, "key", "value");
      assertEquals("value", cache2.get(fqn, "key"));
      txm.commit();

      // since the node already exists even PL will not remove it - but will invalidate it's data
      Node n = cache1.getNode(fqn);
      assertHasBeenInvalidated(n, "Should have been invalidated");
      assertEquals("value", cache2.get(fqn, "key"));

      // now test the invalidation again
      txm = cache1.getTransactionManager();
View Full Code Here

      Fqn fqn = Fqn.fromString("/a/b");

      cache2.put(fqn, "key", "value");
      assertEquals("value", cache2.get(fqn, "key"));
      Node n = cache1.getNode(fqn);
      assertHasBeenInvalidated(n, "Should have been invalidated");
      assertHasBeenInvalidated(cache1.peek(fqn, true, true), "Should have been invalidated");

      // start a tx that cache1 will have to send out an evict ...
      TransactionManager mgr1 = cache1.getTransactionManager();
View Full Code Here

   private void nodeResurrectionTest2(boolean optimistic) throws Exception
   {
      cache1 = createCache(optimistic);
      cache2 = createCache(optimistic);

      Node root1 = cache1.getRoot();
      Node root2 = cache2.getRoot();

      // this fqn is relative, but since it is from the root it may as well be absolute
      Fqn fqn = Fqn.fromString("/test/fqn");
      cache1.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
      root1.addChild(fqn);
      assertEquals(true, root1.hasChild(fqn));
      cache2.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
      root1.addChild(fqn);
      assertEquals(true, root1.hasChild(fqn));

      Fqn child = Fqn.fromRelativeElements(fqn, "child");
      cache1.putForExternalRead(child, "key", "value");
      cache2.putForExternalRead(child, "key", "value");
      assertEquals("value", cache1.get(child, "key"));
      assertEquals("value", cache2.get(child, "key"));

      assertEquals(true, cache1.removeNode(fqn));
      assertFalse(root1.hasChild(fqn));

      cache1.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
      root1.addChild(fqn);
      assertEquals(true, root1.hasChild(fqn));

      Node remoteNode = root2.getChild(fqn);
      checkRemoteNodeIsRemoved(remoteNode);
      cache2.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
      root2.addChild(fqn);
      assertEquals(true, root2.hasChild(fqn));
   }
View Full Code Here

      dumpVersionInfo(cache1, cache2, fqn);

      // test that this has NOT replicated, but rather has been invalidated:
      assertEquals("value", cache1.get(fqn, "key"));
      Node n2 = cache2.getNode(fqn);
      assertHasBeenInvalidated(n2, "Should have been invalidated");
      assertHasBeenInvalidated(cache2.peek(fqn, true, true), "Should have been invalidated");

      // now make sure cache2 is in sync with cache1:
      cache2.put(fqn, "key", "value");

      dumpVersionInfo(cache1, cache2, fqn);

      Node n1 = cache1.getNode(fqn);
      assertHasBeenInvalidated(n1, "Should have been invalidated");
      assertHasBeenInvalidated(cache1.peek(fqn, true, true), "Should have been invalidated");

      assertEquals("value", cache2.get(fqn, "key"));
View Full Code Here

      assertNull("Should be null", caches.get(0).getNode(fqn));
      assertNull("Should be null", caches.get(1).getNode(fqn));

      caches.get(0).put(fqn, "key", "value");
      assertEquals("expecting value", "value", caches.get(0).get(fqn, "key"));
      Node n = caches.get(1).getNode(fqn);
      assertHasBeenInvalidated(n, "Should have been invalidated");

      // now put in caches.get(1), should fire an eviction
      caches.get(1).put(fqn, "key", "value2");
      assertEquals("expecting value2", "value2", caches.get(1).get(fqn, "key"));
View Full Code Here

      for (Fqn internalFqn : internalFqns)
      {
         if (internalFqn.isChildOf(target))
         {
            prepareContextOptions();
            Node node = getInternalNode(cache.getNode(target), internalFqn);
            if (node != null)
            {
               result.add(node.getFqn());
            }
         }
      }

      return result;
View Full Code Here

   private Node getInternalNode(Node parentNode, Fqn internalFqn)
   {
      Fqn parentFqn = parentNode.getFqn();
      Object name = internalFqn.get(parentFqn.size());
      prepareContextOptions();
      Node result = parentNode.getChild(name);
      if (result != null && internalFqn.size() < result.getFqn().size())
      {
         // need to recursively walk down the tree
         result = getInternalNode(result, internalFqn);
      }
View Full Code Here

      cache1.put(fqn, fqn.toString(), fqn.toString());
      cache1.put(internalFqn, fqn.toString(), fqn.toString());

      TestingUtil.sleepThread(wakeupIntervalMillis + 100);
      Node n = cache2.peek(fqn, false);
      assert n == null || !n.getKeys().contains(fqn) : "UnversionedNode should not exist";
      String val;
      val = cache2.get(fqn, fqn.toString());
      val = cache2.get(internalFqn, fqn.toString());
      assertNotNull("Node should be activated ", val);
   }
View Full Code Here

TOP

Related Classes of org.jboss.cache.Node

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.