Package org.jboss.cache.config

Examples of org.jboss.cache.config.EvictionRegionConfig


   {
      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

   {
      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);
View Full Code Here

    * null policy regions but was from lru region.
    */
   public void testEviction() throws InterruptedException
   {
      Configuration config = UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL, true);
      EvictionConfig evConfig = new EvictionConfig(new EvictionRegionConfig(Fqn.ROOT, new NullEvictionAlgorithmConfig(), 200000), 200);
      evConfig.addEvictionRegionConfig(new EvictionRegionConfig(Fqn.fromString("/test"), new NullEvictionAlgorithmConfig()));
      evConfig.addEvictionRegionConfig(new EvictionRegionConfig(Fqn.fromString("/lru"), new LRUAlgorithmConfig(1000, 10000)));
      config.setEvictionConfig(evConfig);
      config.setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
      config.setIsolationLevel(IsolationLevel.SERIALIZABLE);
      cache = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(config);

View Full Code Here

    * Setting up a new region for our purposes.
    */
   private void createNewRegion()
   {
      EvictionConfig evConfig = cache.getConfiguration().getEvictionConfig();
      EvictionRegionConfig evRegConfig = new EvictionRegionConfig();
      evRegConfig.setRegionFqn(Fqn.fromString("/" + TEST_NODES_ROOT));
      evRegConfig.setEventQueueSize(100);
      LRUAlgorithmConfig lruConfig = new LRUAlgorithmConfig();
      lruConfig.setMaxAge(100000000);
      lruConfig.setTimeToLive(100000000);
      lruConfig.setMaxNodes(3);
      evRegConfig.setEvictionAlgorithmConfig(lruConfig);
      evConfig.addEvictionRegionConfig(evRegConfig);
      //end setting up region stuff
   }
View Full Code Here

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

      EvictionConfig ec = new EvictionConfig();
      ec.setWakeupInterval(1000000)// a long time; really disabled
      EvictionRegionConfig erc = new EvictionRegionConfig();
      erc.setRegionFqn(Fqn.ROOT);
      LRUAlgorithmConfig lruAlgorithmConfig = new LRUAlgorithmConfig();
      lruAlgorithmConfig.setMaxNodes(1000);
      lruAlgorithmConfig.setTimeToLive(1000000);
      erc.setEvictionAlgorithmConfig(lruAlgorithmConfig);
      ec.addEvictionRegionConfig(erc);
      config.setEvictionConfig(ec);

      CacheLoaderConfig clc = new CacheLoaderConfig();
      clc.setPassivation(true);
View Full Code Here

   }

   protected EvictionRegionConfig getEvictionRegionConfig(Fqn fqn)
   {
      AbortableLRUAlgorithmConfiguration algoCfg = new AbortableLRUAlgorithmConfiguration();
      EvictionRegionConfig erc = new EvictionRegionConfig(fqn, algoCfg);

      log.debug("Setting time to live to " + cacheConfig.idleTimeoutSeconds() + " seconds and maxNodes to " + cacheConfig.maxSize());

      algoCfg.setTimeToLive((int) cacheConfig.idleTimeoutSeconds(), TimeUnit.SECONDS);
      algoCfg.setMaxNodes(cacheConfig.maxSize());
View Full Code Here

      cacheNode = new Fqn(new Object[] { SFSB, this.ejbContainer.getDeploymentPropertyListString() });
     
      // Try to create an eviction region per ejb
      region = cache.getRegion(cacheNode, true);
      EvictionRegionConfig erc = getEvictionRegionConfig(cacheNode);
      region.setEvictionRegionConfig(erc);

      if (cache.getCacheStatus() != CacheStatus.STARTED)
      {
         if (cache.getCacheStatus() != CacheStatus.CREATED)
View Full Code Here

      EvictionConfig ec = cfg.getEvictionConfig();
      // Create the region and set the config
      Region region = cache.getRegion(fqn, true);
      if (ec != null && ec.getDefaultEvictionRegionConfig() != null)
      {
         EvictionRegionConfig erc = new EvictionRegionConfig(fqn);
         erc.setDefaults(ec.getDefaultEvictionRegionConfig());
         region.setEvictionRegionConfig(erc);
      }
   }
View Full Code Here

   public void setEvictionPolicy(EvictionPolicyConfig evictionPolicyConfig)
   {
      try
      {
         // need to create an EvictionRegionConfig from this.
         EvictionRegionConfig erc = new EvictionRegionConfig(getFqn());
         String epClassName = evictionPolicyConfig.getEvictionPolicyClass();
         EvictionAlgorithmConfig eac = getEvictionAlgorithmConfig(epClassName);
         erc.setEvictionAlgorithmConfig(eac);
         if (!erc.isDefaultRegion())
         {
            erc.setDefaults(regionManager.getConfiguration().getEvictionConfig().getDefaultEvictionRegionConfig());
         }
         setEvictionRegionConfig(erc);
      }
      catch (Exception e)
      {
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.