Package org.jboss.cache

Examples of org.jboss.cache.Cache


   @Override
   public void tearDown() throws Exception
   {
      if (caches.size() > 2 && caches.get(2) != null)
      {
         Cache cache = caches.get(2);
         caches.remove(2);
         cache.stop();
         cache.destroy();
      }
      super.tearDown();
   }
View Full Code Here


  
   public void testRegisterReplicatedCache() throws Exception
   {
      Configuration localConfig = UnitTestConfigurationFactory.createConfiguration(Configuration.CacheMode.REPL_SYNC);
      localConfig.setExposeManagementStatistics(true);
      Cache cache = cacheFactory.createCache(localConfig, getClass());
      JmxRegistrationManager regManager = new JmxRegistrationManager(mBeanServer, cache, (ObjectName)null);
      assert regManager.getObjectNameBase().indexOf(JmxRegistrationManager.REPLICATED_CACHE_PREFIX) == 0;
      regManager.registerAllMBeans();
      String name = regManager.getObjectName(CacheMgmtInterceptor.class.getSimpleName());
      assert mBeanServer.isRegistered(new ObjectName(name));
      regManager.unregisterAllMBeans();
      assert !mBeanServer.isRegistered(new ObjectName(name));
      cache.stop();
   }
View Full Code Here

  
   protected void registerLocalCache() throws Exception
   {
      Configuration localConfig = UnitTestConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL);
      localConfig.setExposeManagementStatistics(true);
      Cache cache = cacheFactory.createCache(localConfig, getClass());
      JmxRegistrationManager regManager = new JmxRegistrationManager(mBeanServer, cache, (ObjectName)null);
      assert regManager.getObjectNameBase().indexOf(JmxRegistrationManager.LOCAL_CACHE_PREFIX) == 0;
      regManager.registerAllMBeans();
      String name = regManager.getObjectName(CacheMgmtInterceptor.class.getSimpleName());
      assert mBeanServer.isRegistered(new ObjectName(name));
      regManager.unregisterAllMBeans();
      assert !mBeanServer.isRegistered(new ObjectName(name));
      cache.stop();
   }
View Full Code Here

   public static void main(String[] args)
   {
      Configuration localConfig = UnitTestConfigurationFactory.createConfiguration(Configuration.CacheMode.REPL_SYNC);
      localConfig.setExposeManagementStatistics(true);
      CacheFactory cacheFactory = new DefaultCacheFactory();
      Cache cache = cacheFactory.createCache(localConfig);
      JmxRegistrationManager regManager = new JmxRegistrationManager(cache);
      while (true){}
   }
View Full Code Here

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

   {
      DefaultCacheFactory ucf = new DefaultCacheFactory();
      for (String aConfFile : getConfigFileNames())
      {
         assert !appender.isFoundUnknownWarning();
         Cache cache = ucf.createCache(CONFIG_ROOT + "/" + aConfFile, true);
         cache.stop();
         cache.destroy();
         assert !appender.isFoundUnknownWarning();
      }
   }
View Full Code Here

      }
   }

   private void doTest(Configuration c)
   {
      Cache cache = null;
      try
      {
         c.getEvictionConfig().setWakeupInterval(0);
         cache = new UnitTestCacheFactory().createCache(c, getClass());

         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

      return delegate.findAll(arg0);
   }

   public Cache<Object, Object> getCache()
   {
      Cache c = delegate.getCache();
      return c == null ? null : new CacheManagerManagedCache(c);
   }
View Full Code Here

  
   private void startEagerStartCaches() throws Exception
   {
      for (Map.Entry<String, Boolean> entry : startupCaches.entrySet())
      {
         Cache cache = null;
         if (entry.getValue().booleanValue())
         {
            PojoCache pc = getPojoCache(entry.getKey(), true);
            cache = pc.getCache();
         }
         else
         {
            cache = getCache(entry.getKey(), true);
         }
        
         if (cache.getCacheStatus() != CacheStatus.STARTED)
         {
            if (cache.getCacheStatus() != CacheStatus.CREATED)
            {
               cache.create();
            }
            cache.start();
         }
      }
   }
View Full Code Here


   @BeforeTest
   public void setUpBeforeTest() throws ParseException
   {
      Cache coreCache = new DefaultCacheFactory().createCache();
      searchableCache = new SearchableCacheFactory().createSearchableCache(coreCache, Person.class);

      person1 = new Person();
      person2 = new Person();
      person3 = new Person();
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.