Package org.jboss.cache.config

Examples of org.jboss.cache.config.EvictionConfig


      assertEquals("Passivated value available from buddy", "value", cache2.get(foo, "key"));
   }

   private void configureEviction(Configuration cfg)
   {
      EvictionConfig ec = new EvictionConfig();
      ec.setWakeupInterval(5000);
      EvictionRegionConfig erc = new EvictionRegionConfig();
      erc.setRegionFqn(Fqn.ROOT);
      LRUAlgorithmConfig lruAlgorithmConfig = new LRUAlgorithmConfig();
      lruAlgorithmConfig.setMaxAge(0);
      lruAlgorithmConfig.setTimeToLive(0);
      lruAlgorithmConfig.setMaxNodes(1);
      erc.setEvictionAlgorithmConfig(lruAlgorithmConfig);
      ec.setDefaultEvictionRegionConfig(erc);
      cfg.setEvictionConfig(ec);
   }
View Full Code Here


   }

   public void testEvictionInterceptorConfig() throws Exception
   {
      cache.getConfiguration().setEvictionConfig(new EvictionConfig()
      {
         private static final long serialVersionUID = -6644183636899605065L;

         public boolean isValidConfig()
         {
View Full Code Here

      cache2 = null;
   }

   private EvictionConfig getEvictionConfig()
   {
      EvictionConfig c = new EvictionConfig();
      EvictionRegionConfig defaultRegion = new EvictionRegionConfig(Fqn.ROOT, new NullEvictionAlgorithmConfig());
      c.setDefaultEvictionRegionConfig(defaultRegion);
      c.setWakeupInterval(1000);

      LRUAlgorithmConfig lru = new LRUAlgorithmConfig(1000, 1000);
      EvictionRegionConfig subregion = new EvictionRegionConfig(fqn, lru);
      c.addEvictionRegionConfig(subregion);
      return c;
   }
View Full Code Here

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

      cache.create();
View Full Code Here

   {
      LRUAlgorithmConfig lru = new LRUAlgorithmConfig(150, 0, 1000);
      EvictionRegionConfig regConfig = new EvictionRegionConfig(Fqn.fromString("/dummy"), lru);

      RegionManager regionManager = cache.getRegionManager();
      EvictionConfig topConfig = cache.getConfiguration().getEvictionConfig();
      topConfig.addEvictionRegionConfig(regConfig);
      regionManager.setEvictionConfig(topConfig);
      // Fqn is the region name
      regionManager.getRegion("/programmatic", true).setEvictionRegionConfig(regConfig);
   }
View Full Code Here

   {
      LRUAlgorithmConfig lru = new LRUAlgorithmConfig(150, 1000);
      EvictionRegionConfig regConfig = new EvictionRegionConfig(Fqn.fromElements(1), lru);

      RegionManager regionManager = cache.getRegionManager();
      EvictionConfig topConfig = cache.getConfiguration().getEvictionConfig();
      topConfig.addEvictionRegionConfig(regConfig);
      regionManager.setEvictionConfig(topConfig);
      regionManager.getRegion(Fqn.fromElements(1), true).setEvictionRegionConfig(regConfig);
   }
View Full Code Here

      assert syncConfig.isUseRegionBasedMarshalling();
   }

   public void testEvictionPolicyConfig()
   {
      EvictionConfig evictionConfig = syncConfig.getEvictionConfig();
      assert "org.jboss.cache.eviction.LRUAlgorithm".equals(evictionConfig.getDefaultEvictionRegionConfig().getEvictionAlgorithmConfig().getEvictionAlgorithmClassName());
      assert 200000 == evictionConfig.getDefaultEvictionRegionConfig().getEventQueueSize();
      assert 5 == evictionConfig.getWakeupInterval();

      List<EvictionRegionConfig> regionConfigs = evictionConfig.getEvictionRegionConfigs();
      assert regionConfigs.size() == 2;

      EvictionRegionConfig first = evictionConfig.getDefaultEvictionRegionConfig();
      assert first.getRegionName().equals("/");
      assert first.getEvictionAlgorithmConfig() instanceof LRUAlgorithmConfig;
      LRUAlgorithmConfig firstConfiguration = (LRUAlgorithmConfig) first.getEvictionAlgorithmConfig();
      assert firstConfiguration.getMaxAge() <= 0;
      assert firstConfiguration.getTimeToLive() == 1000;
View Full Code Here

   }

   private void initCaches()
   {
      Configuration config = UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL, true);
      EvictionConfig evConfig = config.getEvictionConfig();
      evConfig.setWakeupInterval(200);
      // root ERC
      evConfig.setDefaultEvictionRegionConfig(new EvictionRegionConfig(Fqn.ROOT, new MRUAlgorithmConfig(100), 200000));
      // new region ERC
      evConfig.addEvictionRegionConfig(new EvictionRegionConfig(Fqn.fromString("/org/jboss/test/data"), new MRUAlgorithmConfig(6)));


      config.setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
      config.setIsolationLevel(IsolationLevel.SERIALIZABLE);
      cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(config);
View Full Code Here

   }

   void initCaches() throws Exception
   {
      Configuration conf = UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL, true);
      EvictionConfig evConfig = new EvictionConfig(new EvictionRegionConfig(Fqn.ROOT, new ElementSizeAlgorithmConfig(5000, 100), 200000), 200);
      evConfig.addEvictionRegionConfig(new EvictionRegionConfig(Fqn.fromString("/org/jboss/data"), new ElementSizeAlgorithmConfig(10, 20)));
      evConfig.addEvictionRegionConfig(new EvictionRegionConfig(Fqn.fromString("/org/jboss/test/data"), new ElementSizeAlgorithmConfig(-1, 5)));
      evConfig.addEvictionRegionConfig(new EvictionRegionConfig(Fqn.fromString("/test/"), new ElementSizeAlgorithmConfig(5000, 1)));
      conf.setEvictionConfig(evConfig);
      cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(conf, false);
      cache.getConfiguration().setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
      cache.getConfiguration().setIsolationLevel(IsolationLevel.SERIALIZABLE);
      cache.start();
View Full Code Here

   @BeforeMethod(alwaysRun = true)
   public void setUp() throws Exception
   {
      Configuration conf = UnitTestCacheConfigurationFactory.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);

      wakeupIntervalMillis = cache.getConfiguration().getEvictionConfig().getWakeupInterval();
View Full Code Here

TOP

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

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.