Package org.jboss.cache

Examples of org.jboss.cache.Cache


      return pc == null ? null : pc.getLocalAddress();
   }

   public List<Object> getMembers()
   {
      Cache pc = delegate.getPlainCache();
      return pc == null ? null : new ArrayList<Object>(pc.getMembers());
   }
View Full Code Here


         if (cacheHandler == null)
         {
            throw new IllegalStateException("No clustered cache available");
         }
        
         @SuppressWarnings("unchecked")
         Cache c = null;
         synchronized (cacheHandler)
         {
            c = cacheHandler.getCache();
            if (c == null)
View Full Code Here

      }
   }

   private void doTest(Configuration c)
   {
      Cache cache = null;
      try
      {
         cache = new UnitTestCacheFactory().createCache(c);

         EvictionRegionConfig erc = cache.getRegion(Fqn.ROOT, false).getEvictionRegionConfig();
         assert erc.getEvictionAlgorithmConfig() instanceof FIFOAlgorithmConfig;
         assert erc.getEvictionActionPolicyClassName().equals(DefaultEvictionActionPolicy.class.getName());

         cache.put("/a/b/1", "a", "b");
         cache.put("/a/b/2", "a", "b");
         cache.put("/a/b/3", "a", "b");

         new EvictionController(cache).startEviction();

         assert cache.getNode("/a/b/1") == null;
         assert cache.getNode("/a/b/2") != null;
         assert cache.getNode("/a/b/3") != null;
      }
      finally
      {
         TestingUtil.killCaches(cache);
      }
View Full Code Here

   }


   private void doTest(NodeLockingScheme nls, boolean set)
   {
      Cache c = null;
      try
      {
         c = new UnitTestCacheFactory().createCache(false);
         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

      Properties prop = getProperties();

      // ensure cleanup after each test
      prop.setProperty("cache.jdbc.table.drop", "true");

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

      int wakeupInterval = 1000000; // a long time; really disabled
      EvictionConfig ec = new EvictionConfig(
View Full Code Here

      c1.stop();

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

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

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

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

@Test(groups = "functional")
public class ComponentRegistryUnitTest
{
   public void testConstruction()
   {
      Cache c = new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.REPL_SYNC));
      c.put("/a", "b", "c");
      c.stop();
      c.destroy();
   }
View Full Code Here

      CacheJmxWrapperMBean<String, String> wrapper = registerWrapper(c);
      wrapper.start();

      c = createConfiguration();
      c.setCacheMode(CacheMode.REPL_ASYNC);
      Cache cache2 = null;
      try
      {
         cache2 = createCache(c);
         cache2.start();
         Cache[] caches = new Cache[]{wrapper.getCache(), cache2};
         TestingUtil.blockUntilViewsReceived(caches, 5000);

         Address addr = wrapper.getLocalAddress();
         assertNotNull("Got an Address", addr);
         List members = wrapper.getMembers();
         assertNotNull("Got members", addr);
         assertEquals("Got correct number of members", 2, members.size());
         assertTrue("I am a member", members.contains(addr));
      }
      finally
      {
         if (cache2 != null)
         {
            cache2.destroy();
         }
      }
   }
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

      UnitTestCacheFactory ucf = new UnitTestCacheFactory();
      for (String aConfFile : getConfigFileNames())
      {
         System.out.println("Processing file: " + aConfFile);
         assert !appender.isFoundUnknownWarning();
         Cache cache = ucf.createCache(CONFIG_ROOT + "/" + aConfFile, false);
//         cache.stop();
         assert !appender.isFoundUnknownWarning();
      }
   }
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.