Package org.jboss.cache

Examples of org.jboss.cache.Fqn


                  }
                  return;
               }
               // the first worker would create a new node for the FQN
               // all the others would update the same node
               Fqn fqn = Fqn.fromString("/NODE/" + i);
               for (int m = 0; m < m_modificationsPerTx; m++)
               {
                  cache.put(fqn, m, i);
                  if (checkAndSetState())
                  {


      configureCache(
            "cache.async.queueSize=1\n" +
                  "cache.async.pollWait=10\n" +
                  "cache.async.threadPoolSize=5", true);
      CacheLoader loader = cache.getCacheLoaderManager().getCacheLoader();
      Fqn fqn = Fqn.fromString("/bound");
      loader.remove(fqn);
      // You can't really see it block though :-/
      for (int i = 0; i < 50; i++)
      {
         cache.put(fqn, "key" + i, "value1");

      debugMessage("Did a put on " + name + ", data is " + n.data);
   }

   private void recursivelyPutParentsIfNeeded(Fqn node)
   {
      Fqn parent = node.getParent();
      if (getNodesMap().containsKey(parent)) return; // nothing to do.

      // else put the parent in.
      getNodesMap().put(parent, new DummyNode(parent));
      recursivelyPutParentsIfNeeded(parent);

      Cache<String, String> cacheJmx = (Cache<String, String>) mBeanServer.getAttribute(mBeanName, "Cache");
      cacheJmx.getRoot().put("key", "value");

      assertEquals("value", cache.getRoot().get("key"));

      Fqn fqn = Fqn.fromString("/testing/jmx");
      cache.put(fqn, "key", "value");

      assertEquals("value", cacheJmx.get(fqn, "key"));
   }

   {
      CacheJmxWrapperMBean<String, String> wrapper = registerWrapper();

      // have to start the cache before we'll have a root
      cache.start();
      Fqn fqn = Fqn.fromString("/testing/jmx");
      cache.put(fqn, "foobar", "barfoo");

      assertEquals("barfoo", cache.get(fqn, "foobar"));

      String details = html ? wrapper.printCacheDetailsAsHtml() : wrapper.printCacheDetails();

      TransactionManager tm = config.getRuntimeConfig().getTransactionManager();

      tm.begin();
      try
      {
         Fqn fqn = Fqn.fromString("/testing/jmx");
         cache.put(fqn, "foobar", "barfoo");

         String locks = html ? wrapper.printLockInfoAsHtml() : wrapper.printLockInfo();

         assertTrue("Details include testing", locks.contains("testing"));

   {
      Cache<Object, Object>[] caches = cachesTL.get();
      assertClusterSize("Should only be 2  caches in the cluster!!!", 2);
      assertInvocationContextInitState();

      Fqn f = Fqn.fromString("/test/data");
      String k = "key", v = "value";

      assertNull("Should be null", caches[0].getRoot().getChild(f));
      assertNull("Should be null", caches[1].getRoot().getChild(f));

   {
      Cache<Object, Object>[] caches = cachesTL.get();
      assertClusterSize("Should only be 2  caches in the cluster!!!", 2);
      assertInvocationContextInitState();

      Fqn fqn = Fqn.fromString("/JSESSIONID/1010.10.5:3000/1234567890/1");
      caches[0].getConfiguration().setSyncCommitPhase(true);
      caches[1].getConfiguration().setSyncCommitPhase(true);

      caches[0].put(fqn, "age", 38);
      assertEquals("Value should be set", 38, caches[0].get(fqn, "age"));

   @SuppressWarnings("unchecked")
   public void testNodeConvenienceNodeRemoval()
   {
      Cache<Object, Object>[] caches = cachesTL.get();
      // this fqn is relative, but since it is from the root it may as well be absolute
      Fqn fqn = Fqn.fromString("/test/fqn");
      caches[0].getRoot().addChild(fqn);
      assertTrue(caches[0].getRoot().hasChild(fqn));
      assertTrue(caches[1].getRoot().hasChild(fqn));

      assertEquals(true, caches[0].removeNode(fqn));
      assertFalse(caches[0].getRoot().hasChild(fqn));
      assertFalse(caches[1].getRoot().hasChild(fqn));
      assertEquals(false, caches[0].removeNode(fqn));

      // Confirm it works as expected if the removed node has a child
      Fqn child = Fqn.fromString("/test/fqn/child");
      caches[0].getRoot().addChild(child);
      assertTrue(caches[0].getRoot().hasChild(child));
      assertTrue(caches[1].getRoot().hasChild(child));

      assertEquals(true, caches[0].removeNode(fqn));

      // modify a node - this will trigger NodeModified and NodeModify(pre/post)
      cache.put("Europe/Albania", POPULATION, 3563112);

      // retrieve an attribute - this will trigger NodeVisited
      Fqn key = Fqn.fromString("Europe/Albania");
      assertNotNull("Retrieval error: expected to retrieve " + CURRENCY + " for " + key, cache.get(key, CURRENCY));

      // evict the node - this will trigger NodePassivate, NodeEvicted and NodeEvict(pre/post)
      cache.evict(key);

TOP

Related Classes of org.jboss.cache.Fqn

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.