Package org.jboss.cache

Examples of org.jboss.cache.Cache


     
      Set<Cache> caches = new HashSet<Cache>();
     
      for (String name : cores)
      {
         Cache cache = registry.getCache(name, false);
         assertNotNull(cache);
         assertEquals(CacheStatus.STARTED, cache.getCacheStatus());
         caches.add(cache);
      }
     
      for (String name : pojos)
      {
         PojoCache pojocache = registry.getPojoCache(name, false);
         assertNotNull(pojocache);
         Cache cache = pojocache.getCache();
         assertEquals(CacheStatus.STARTED, cache.getCacheStatus());
         caches.add(cache);
      }
     
      for (String name : cores)
      {
         registry.releaseCache(name);
      }
     
      for (String name : pojos)
      {
         registry.releaseCache(name);
      }
     
      for (Cache cache : caches)
      {
         assertEquals(CacheStatus.STARTED, cache.getCacheStatus());        
      }
     
      registry.stop();
     
      for (Cache cache : caches)
      {
         assertEquals(CacheStatus.DESTROYED, cache.getCacheStatus());        
      }
     
   }
View Full Code Here


      c1.stop();

      assert l1.exists(A);
      assert l1.get(A).get("K").equals("V");

      Cache c2 = createCache(true, false, true, true);

      c2.put(B, "K", "V");

      assert c1.getConfiguration().isFetchInMemoryState();
      assert c1.getConfiguration().getCacheLoaderConfig().isFetchPersistentState();
      c1.start();
View Full Code Here

      usabilityCheck();
   }

   private void cacheCheck()
   {
      Cache c = cache_server.getCache();
      assertNotNull("Cache exists", c);
      Configuration config = c.getConfiguration();
      // check a couple properties
      assertEquals("Correct mode", Configuration.CacheMode.LOCAL, config.getCacheMode());
      assertEquals("Correct cluster name", "JBossCache-Cluster", config.getClusterName());
   }
View Full Code Here

   private Cache createCache(boolean useRegionBased)
   {
      Configuration config = new Configuration();
      config.setUseRegionBasedMarshalling(useRegionBased);
      config.setInactiveOnStartup(useRegionBased);
      Cache cache = new UnitTestCacheFactory<Object, Object>().createCache(config, false, getClass());

      EvictionConfig ec = new EvictionConfig();
      ec.setWakeupInterval(1000000)// a long time; really disabled
      EvictionRegionConfig erc = new EvictionRegionConfig();
      erc.setRegionFqn(Fqn.ROOT);
View Full Code Here

   }


   private void doTest(NodeLockingScheme nls, boolean set)
   {
      Cache c = null;
      try
      {
         c = new UnitTestCacheFactory().createCache(false, getClass());
         c.getConfiguration().setNodeLockingScheme(nls);
         c.getConfiguration().setLockParentForChildInsertRemove(set);
         if (nls.isVersionedScheme())
            c.getConfiguration().setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
         c.start();
         assert c.getRoot().isLockForChildInsertRemove() == set;
      }
      finally
      {
         TestingUtil.killCaches(c);
      }
View Full Code Here

   public void testMemConsumption() throws IOException
   {     
      int kBytesCached = (bytesPerCharacter * numNodes * (payloadSize + keySize)) / 1024;
      System.out.println("Bytes to be cached: " + NumberFormat.getIntegerInstance().format(kBytesCached) + " kb");

      Cache c = new DefaultCacheFactory().createCache(false); // default LOCAL cache
      c.start();
      for (int i = 0; i < numNodes; i++)
      {
         switch (payloadType)
         {
            case STRINGS:
               c.put(Fqn.fromString("/node" + i), generateRandomString(keySize), generateRandomString(payloadSize));
               break;
            case BYTE_ARRAYS:
               c.put(Fqn.fromString("/node" + i), generateUniqueKey(i, keySize), generateBytePayload(payloadSize));
               break;
            default:
               throw new CacheException("Unknown payload type");
         }

View Full Code Here

public class JmxManualTest
{
   public void testLocal() throws IOException
   {
      Configuration c = new Configuration();
      Cache cache = new DefaultCacheFactory().createCache(c);
      cache.put("/a/b/c", "a", "b");
      cache.put("/a/b/c", "c", "d");
      cache.put("/a/b/d", "a", "b");
      cache.put("/a/b/e", "c", "d");

      System.in.read();
   }
View Full Code Here

   public void testLocalNoJMX() throws IOException
   {
      Configuration c = new Configuration();
      c.setExposeManagementStatistics(false);
      Cache cache = new DefaultCacheFactory().createCache(c);
      cache.put("/a/b/c", "a", "b");
      cache.put("/a/b/c", "c", "d");
      cache.put("/a/b/d", "a", "b");
      cache.put("/a/b/e", "c", "d");

      System.in.read();
   }
View Full Code Here

      EvictionRegionConfig erc = new EvictionRegionConfig();
      erc.setEvictionAlgorithmConfig(new FIFOAlgorithmConfig(2));
      erc.setRegionFqn(Fqn.ROOT);
      ec.setDefaultEvictionRegionConfig(erc);
      c.setEvictionConfig(ec);
      Cache cache = new DefaultCacheFactory().createCache(c);
      cache.put("/a/b/c", "a", "b");
      cache.put("/a/b/c", "c", "d");
      cache.put("/a/b/d", "a", "b");
      cache.put("/a/b/e", "c", "d");

      System.in.read();
   }
View Full Code Here

      System.in.read();
   }

   public void testLocalWithEvictionXML() throws IOException
   {
      Cache cache = new DefaultCacheFactory().createCache("config-samples/eviction-enabled.xml");
      cache.put("/a/b/c", "a", "b");
      cache.put("/a/b/c", "c", "d");
      cache.put("/a/b/d", "a", "b");
      cache.put("/a/b/e", "c", "d");

      System.in.read();
   }
View Full Code Here

TOP

Related Classes of org.jboss.cache.Cache

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.