Package org.jboss.cache.config

Examples of org.jboss.cache.config.EvictionRegionConfig


      ExpirationAlgorithmConfig lfu  = new ExpirationAlgorithmConfig();
      lfu.setMaxNodes(config.getMaxEntries());
      evictionConfig = lfu;
    }
   
    EvictionRegionConfig erc = new EvictionRegionConfig(rootFqn, evictionConfig);
    erc.setEvictionActionPolicyClassName(RemoveOnEvictActionPolicy.class.getName());
    return erc;
 
View Full Code Here


      FIFOAlgorithmConfig cfg = new FIFOAlgorithmConfig();
      cfg.setMaxNodes(1);
      cfg.setMinTimeToLive(0);

      // the region configuration
      EvictionRegionConfig regionCfg = new EvictionRegionConfig();
      regionCfg.setRegionFqn(dummy.getParent());
      regionCfg.setRegionName(dummy.getParent().toString());
      regionCfg.setEvictionAlgorithmConfig(cfg);

      // set regions in a list
      List<EvictionRegionConfig> evictionRegionConfigs = new ArrayList<EvictionRegionConfig>();
      evictionRegionConfigs.add(regionCfg);
View Full Code Here

      EvictionConfig ec = c.getEvictionConfig();
      assertEquals("EC queue size", 1000, ec.getDefaultEvictionRegionConfig().getEventQueueSize());
      assertEquals("EC wakeup", 5000, ec.getWakeupInterval());
      assertEquals("EC default pol", LRUAlgorithm.class.getName(), ec.getDefaultEvictionRegionConfig().getEvictionAlgorithmConfig().getEvictionAlgorithmClassName());
      List<EvictionRegionConfig> ercs = ec.getEvictionRegionConfigs();
      EvictionRegionConfig erc = ercs.get(0);
      assertEquals("ERC1 name", "/org/jboss/data", erc.getRegionName());
      assertEquals("ERC1 queue size", 1000, erc.getEventQueueSize());
      FIFOAlgorithmConfig fifo = (FIFOAlgorithmConfig) erc.getEvictionAlgorithmConfig();
      assertEquals("EPC1 pol", FIFOAlgorithm.class.getName(), fifo.getEvictionAlgorithmClassName());
      assertEquals("EPC1 maxnodes", 5000, fifo.getMaxNodes());
      erc = ercs.get(1);
      assertEquals("ERC2 name", "/test", erc.getRegionName());
      assertEquals("ERC2 queue size", 1000, erc.getEventQueueSize());
      MRUAlgorithmConfig mru = (MRUAlgorithmConfig) erc.getEvictionAlgorithmConfig();
      assertEquals("EPC2 pol", MRUAlgorithm.class.getName(), mru.getEvictionAlgorithmClassName());
      assertEquals("EPC2 maxnodes", 10000, mru.getMaxNodes());
      erc = ercs.get(2);
      assertEquals("ERC3 name", "/maxAgeTest", erc.getRegionName());
      assertEquals("ERC3 queue size", 1000, erc.getEventQueueSize());
      LRUAlgorithmConfig lru = (LRUAlgorithmConfig) erc.getEvictionAlgorithmConfig();
      assertEquals("EPC3 maxnodes", 10000, lru.getMaxNodes());
      assertEquals("EPC3 maxage", 10000, lru.getMaxAge());
      assertEquals("EPC3 ttl", 8000, lru.getTimeToLive());

   }
View Full Code Here

      config.setUseRegionBasedMarshalling(useRegionBased);
      config.setInactiveOnStartup(useRegionBased);

      int wakeupInterval = 1000000; // a long time; really disabled
      EvictionConfig ec = new EvictionConfig(
            new EvictionRegionConfig(
                  Fqn.ROOT,
                  new LRUAlgorithmConfig(1000000, 0, 1000)
            ),
            wakeupInterval
      );
View Full Code Here

         cache = setupCache("configs/policyPerRegion-eviction.xml");
         regionManager = cache.getRegionManager();
         assertEquals(5000, cache.getConfiguration().getEvictionConfig().getWakeupInterval());

         Region region = regionManager.getRegion("/org/jboss/data", true);
         EvictionRegionConfig evictionRegionConfig = region.getEvictionRegionConfig();
         assertEquals(Fqn.fromString("/org/jboss/data"), region.getFqn());
         assertTrue(evictionRegionConfig.getEvictionAlgorithmConfig() instanceof LFUAlgorithmConfig);
         assertEquals(5000, ((LFUAlgorithmConfig) evictionRegionConfig.getEvictionAlgorithmConfig()).getMaxNodes());
         assertEquals(1000, ((LFUAlgorithmConfig) evictionRegionConfig.getEvictionAlgorithmConfig()).getMinNodes());

         region = regionManager.getRegion("/org/jboss/test/data", true);
         evictionRegionConfig = region.getEvictionRegionConfig();
         assertEquals(Fqn.fromString("/org/jboss/test/data"), region.getFqn());
         assertTrue(evictionRegionConfig.getEvictionAlgorithmConfig() instanceof FIFOAlgorithmConfig);
         assertEquals(5, ((FIFOAlgorithmConfig) evictionRegionConfig.getEvictionAlgorithmConfig()).getMaxNodes());

         region = regionManager.getRegion("/test", true);
         evictionRegionConfig = region.getEvictionRegionConfig();
         assertEquals(Fqn.fromString("/test"), region.getFqn());
         assertTrue(evictionRegionConfig.getEvictionAlgorithmConfig() instanceof MRUAlgorithmConfig);
         assertEquals(10000, ((MRUAlgorithmConfig) evictionRegionConfig.getEvictionAlgorithmConfig()).getMaxNodes());

         region = regionManager.getRegion("/maxAgeTest", true);
         evictionRegionConfig = region.getEvictionRegionConfig();
         assertEquals(Fqn.fromString("/maxAgeTest"), region.getFqn());
         assertTrue(evictionRegionConfig.getEvictionAlgorithmConfig() instanceof LRUAlgorithmConfig);
         assertEquals(10000, ((LRUAlgorithmConfig) evictionRegionConfig.getEvictionAlgorithmConfig()).getMaxNodes());
         assertEquals(8000, ((LRUAlgorithmConfig) evictionRegionConfig.getEvictionAlgorithmConfig()).getTimeToLive());
         assertEquals(10000, ((LRUAlgorithmConfig) evictionRegionConfig.getEvictionAlgorithmConfig()).getMaxAge());

         // test the default region. use a region name that isn't defined explicitly in conf file.
         region = regionManager.getRegion("/a/b/c", false);
         evictionRegionConfig = region.getEvictionRegionConfig();
         assertEquals(Fqn.ROOT, region.getFqn());
         assertTrue(evictionRegionConfig.getEvictionAlgorithmConfig() instanceof LRUAlgorithmConfig);
         assertEquals(5000, ((LRUAlgorithmConfig) evictionRegionConfig.getEvictionAlgorithmConfig()).getMaxNodes());
         assertEquals(1000000, ((LRUAlgorithmConfig) evictionRegionConfig.getEvictionAlgorithmConfig()).getTimeToLive());
         assertEquals(-1, ((LRUAlgorithmConfig) evictionRegionConfig.getEvictionAlgorithmConfig()).getMaxAge());

      }
      finally
      {
         TestingUtil.killCaches(cache);
View Full Code Here

         cache = setupCache("configs/mixedPolicy-eviction.xml");
         regionManager = cache.getRegionManager();
         assertEquals(5000, cache.getConfiguration().getEvictionConfig().getWakeupInterval());

         Region region = regionManager.getRegion("/org/jboss/data", true);
         EvictionRegionConfig evictionRegionConfig = region.getEvictionRegionConfig();
         assertEquals(Fqn.fromString("/org/jboss/data/"), region.getFqn());
         assertTrue(evictionRegionConfig.getEvictionAlgorithmConfig() instanceof FIFOAlgorithmConfig);
         assertEquals(5000, ((FIFOAlgorithmConfig) evictionRegionConfig.getEvictionAlgorithmConfig()).getMaxNodes());

         region = regionManager.getRegion("/test", true);
         evictionRegionConfig = region.getEvictionRegionConfig();
         assertEquals(Fqn.fromString("/test/"), region.getFqn());
         assertTrue(evictionRegionConfig.getEvictionAlgorithmConfig() instanceof MRUAlgorithmConfig);
         assertEquals(10000, ((MRUAlgorithmConfig) evictionRegionConfig.getEvictionAlgorithmConfig()).getMaxNodes());

         // test the default region. use a region name that isn't defined explicitly in conf file.
         region = regionManager.getRegion("/a/b/c", false);
         evictionRegionConfig = region.getEvictionRegionConfig();
         assertEquals(Fqn.ROOT, region.getFqn());
         assertTrue(evictionRegionConfig.getEvictionAlgorithmConfig() instanceof LRUAlgorithmConfig);
         assertEquals(5000, ((LRUAlgorithmConfig) evictionRegionConfig.getEvictionAlgorithmConfig()).getMaxNodes());
         assertEquals(1000000, ((LRUAlgorithmConfig) evictionRegionConfig.getEvictionAlgorithmConfig()).getTimeToLive());
         assertEquals(-1, ((LRUAlgorithmConfig) evictionRegionConfig.getEvictionAlgorithmConfig()).getMaxAge());

         region = regionManager.getRegion("/maxAgeTest", false);
         evictionRegionConfig = region.getEvictionRegionConfig();
         assertEquals(Fqn.fromString("/maxAgeTest/"), region.getFqn());
         assertTrue(evictionRegionConfig.getEvictionAlgorithmConfig() instanceof LRUAlgorithmConfig);
         assertEquals(10000, ((LRUAlgorithmConfig) evictionRegionConfig.getEvictionAlgorithmConfig()).getMaxNodes());
         assertEquals(8000, ((LRUAlgorithmConfig) evictionRegionConfig.getEvictionAlgorithmConfig()).getTimeToLive());
         assertEquals(10000, ((LRUAlgorithmConfig) evictionRegionConfig.getEvictionAlgorithmConfig()).getMaxAge());

      }
      finally
      {
         TestingUtil.killCaches(cache);
View Full Code Here

         cache = setupCache("configs/local-lru-eviction.xml");
         regionManager = cache.getRegionManager();
         assertEquals(5000, cache.getConfiguration().getEvictionConfig().getWakeupInterval());

         Region region = regionManager.getRegion("/org/jboss/data", false);
         EvictionRegionConfig evictionRegionConfig = region.getEvictionRegionConfig();
         assertEquals(Fqn.fromString("/org/jboss/data/"), region.getFqn());
         assertTrue(evictionRegionConfig.getEvictionAlgorithmConfig() instanceof LRUAlgorithmConfig);
         assertEquals(5000, ((LRUAlgorithmConfig) evictionRegionConfig.getEvictionAlgorithmConfig()).getMaxNodes());
         assertEquals(1000000, ((LRUAlgorithmConfig) evictionRegionConfig.getEvictionAlgorithmConfig()).getTimeToLive());

         region = regionManager.getRegion("/org/jboss/test/data", false);
         evictionRegionConfig = region.getEvictionRegionConfig();
         assertEquals(Fqn.fromString("/org/jboss/test/data/"), region.getFqn());
         assertTrue(evictionRegionConfig.getEvictionAlgorithmConfig() instanceof LRUAlgorithmConfig);
         assertEquals(5, ((LRUAlgorithmConfig) evictionRegionConfig.getEvictionAlgorithmConfig()).getMaxNodes());
         assertEquals(4000, ((LRUAlgorithmConfig) evictionRegionConfig.getEvictionAlgorithmConfig()).getTimeToLive());

         region = regionManager.getRegion("/test", true);
         evictionRegionConfig = region.getEvictionRegionConfig();
         assertEquals(Fqn.fromString("/test/"), region.getFqn());
         assertTrue(evictionRegionConfig.getEvictionAlgorithmConfig() instanceof LRUAlgorithmConfig);
         assertEquals(10000, ((LRUAlgorithmConfig) evictionRegionConfig.getEvictionAlgorithmConfig()).getMaxNodes());
         assertEquals(4000, ((LRUAlgorithmConfig) evictionRegionConfig.getEvictionAlgorithmConfig()).getTimeToLive());

         region = regionManager.getRegion("/maxAgeTest", true);
         evictionRegionConfig = region.getEvictionRegionConfig();
         assertEquals(Fqn.fromString("/maxAgeTest/"), region.getFqn());
         assertTrue(evictionRegionConfig.getEvictionAlgorithmConfig() instanceof LRUAlgorithmConfig);
         assertEquals(10000, ((LRUAlgorithmConfig) evictionRegionConfig.getEvictionAlgorithmConfig()).getMaxNodes());
         assertEquals(8000, ((LRUAlgorithmConfig) evictionRegionConfig.getEvictionAlgorithmConfig()).getTimeToLive());
         assertEquals(10000, ((LRUAlgorithmConfig) evictionRegionConfig.getEvictionAlgorithmConfig()).getMaxAge());

         // test the default region. use a region name that isn't defined explicitly in conf file.
         region = regionManager.getRegion("/a/b/c", false);
         evictionRegionConfig = region.getEvictionRegionConfig();
         assertEquals(Fqn.ROOT, region.getFqn());
         assertTrue(evictionRegionConfig.getEvictionAlgorithmConfig() instanceof LRUAlgorithmConfig);
         assertEquals(5000, ((LRUAlgorithmConfig) evictionRegionConfig.getEvictionAlgorithmConfig()).getMaxNodes());
         assertEquals(1000000, ((LRUAlgorithmConfig) evictionRegionConfig.getEvictionAlgorithmConfig()).getTimeToLive());
         assertEquals(-1, ((LRUAlgorithmConfig) evictionRegionConfig.getEvictionAlgorithmConfig()).getMaxAge());

      }
      finally
      {
         TestingUtil.killCaches(cache);
View Full Code Here

   }

   void initCaches() throws Exception
   {
      Configuration config = UnitTestConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL, true);
      EvictionConfig evConfig = new EvictionConfig(new EvictionRegionConfig(Fqn.ROOT, new LFUAlgorithmConfig(maxNodesDefault, minNodesDefault), 200000), 0);
      evConfig.addEvictionRegionConfig(new EvictionRegionConfig(Fqn.fromString("/org/jboss/data"), new LFUAlgorithmConfig(maxNodesR1, minNodesR1)));
      evConfig.addEvictionRegionConfig(new EvictionRegionConfig(Fqn.fromString("/org/jboss/test/data"), new LFUAlgorithmConfig(maxNodesR2, minNodesR2)));
      config.setEvictionConfig(evConfig);
      config.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
      config.setIsolationLevel(IsolationLevel.SERIALIZABLE);
      cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(config, true, getClass());
      evController = new EvictionController(cache);
View Full Code Here

   {
      Configuration conf = UnitTestConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL, true);
      EvictionConfig evConfig = conf.getEvictionConfig();
      evConfig.setWakeupInterval(wakeupIntervalMillis);
      List<EvictionRegionConfig> regionConfigs = new ArrayList<EvictionRegionConfig>();
      regionConfigs.add(new EvictionRegionConfig(Fqn.fromString("/org/jboss/test/data"), new LRUAlgorithmConfig(dataRegionTTLMillis, -1, 5)));
      regionConfigs.add(new EvictionRegionConfig(Fqn.fromString("/test"), new LRUAlgorithmConfig(testRegionTTLMillis, 10000)));
      regionConfigs.add(new EvictionRegionConfig(Fqn.fromString("/base"), new LRUAlgorithmConfig(baseRegionTTLMillis, -1, baseRegionMaxNodes)));
      evConfig.setEvictionRegionConfigs(regionConfigs);
      conf.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
      conf.setIsolationLevel(IsolationLevel.SERIALIZABLE);
      cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(conf, getClass());
View Full Code Here

   private void initCache()
   {
      Configuration conf = UnitTestConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL, true);
      UnitTestCacheFactory<Object, Object> instance = new UnitTestCacheFactory<Object, Object>();
      cache = (CacheSPI<Object, Object>) instance.createCache(conf, false, getClass());
      EvictionConfig erc = new EvictionConfig(new EvictionRegionConfig(Fqn.ROOT, new LRUAlgorithmConfig(0, 0, 10)), -1);
      conf.setEvictionConfig(erc);
      cache.getConfiguration().setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
      cache.getConfiguration().setIsolationLevel(IsolationLevel.SERIALIZABLE);

      cache.create();
View Full Code Here

TOP

Related Classes of org.jboss.cache.config.EvictionRegionConfig

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.