Package org.jboss.cache.config

Examples of org.jboss.cache.config.EvictionConfig


    * 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

      Configuration config = new Configuration();
      config.setUseRegionBasedMarshalling(useRegionBased);
      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);
      clc.setShared(false);
View Full Code Here

    * @param cache the cache to which we want to add the region
    * @param cfg the configuration from which the Eviction Algorithm Config must be extracted
    */
   private static <K, V> void addEvictionRegion(Fqn<String> fqn, Cache<K, V> cache, Configuration cfg)
   {
      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

    */
   protected void cleanConfigurationTemplate(Cache<Serializable, Object> cache, String region)
   {
      final Configuration config = cache.getConfiguration();
      // Reset the eviction policies
      EvictionConfig evictionConfig = config.getEvictionConfig();
      if (evictionConfig == null)
      {
         // If not eviction config exists, we create an empty one
         evictionConfig = new EvictionConfig();
         config.setEvictionConfig(evictionConfig);
      }
      evictionConfig.setEvictionRegionConfigs(new LinkedList<EvictionRegionConfig>());
      // Rename the cluster name
      String clusterName = config.getClusterName();
      if (clusterName != null && (clusterName = clusterName.trim()).length() > 0)
      {
         config.setClusterName(clusterName + " " + region);
View Full Code Here

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

      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);
      clc.setShared(false);
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

      return clc;
   }

   private EvictionConfig buildEvictionConfig() throws Exception
   {
      EvictionConfig cfg = new EvictionConfig();
      cfg.setWakeupInterval(1000);
      cfg.setDefaultEventQueueSize(200000);

      EvictionRegionConfig region1 = new EvictionRegionConfig();
      region1.setRegionFqn(Fqn.ROOT);
      LRUAlgorithmConfig epc1 = new LRUAlgorithmConfig();
      epc1.setMaxNodes(5000);
      epc1.setTimeToLive(3000);
      region1.setEvictionAlgorithmConfig(epc1);
      cfg.setDefaultEvictionRegionConfig(region1);

      EvictionRegionConfig region2 = new EvictionRegionConfig();
      region2.setRegionFqn(base);
      LRUAlgorithmConfig epc2 = new LRUAlgorithmConfig();
      epc2.setMaxNodes(100);
      epc2.setTimeToLive(3000);
      region2.setEvictionAlgorithmConfig(epc2);
      cfg.addEvictionRegionConfig(region2);

      return cfg;
   }
View Full Code Here

      cache.getConfiguration().setCacheLoaderConfig(clc);
   }

   protected void configureEviction() throws Exception
   {
      EvictionConfig ec = new EvictionConfig();
      ec.setWakeupInterval(1000);

      LRUAlgorithmConfig lru = new LRUAlgorithmConfig();
      lru.setMaxNodes(0);
      lru.setTimeToLive(5000);
      ec.setDefaultEvictionRegionConfig(new EvictionRegionConfig(Fqn.ROOT, lru));

      lru = new LRUAlgorithmConfig();
      lru.setMaxNodes(0);
      lru.setTimeToLive(1000);
      ec.addEvictionRegionConfig(new EvictionRegionConfig(BASE, lru));

      cache.getConfiguration().setEvictionConfig(ec);
   }
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

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.