Package org.jboss.cache.config

Examples of org.jboss.cache.config.Configuration


   public void testControl()
   {
      Cache<String, String> c = null;
      try
      {
         Configuration cfg = UnitTestConfigurationFactory.createConfiguration(CacheMode.LOCAL, true);
         cfg.getEvictionConfig().setWakeupInterval(10);
         c = new UnitTestCacheFactory<String, String>().createCache(cfg, getClass());
         ComponentRegistry cr = TestingUtil.extractComponentRegistry(c);
         RegionManager rm = cr.getComponent(RegionManager.class);
         EvictionTimerTask ett = rm.getEvictionTimerTask();
         assert ett.scheduledExecutor != null;
View Full Code Here


      evController = new EvictionController(cache);
   }

   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();
      cache.start();
View Full Code Here

      cache = null;
   }

   private void initCaches()
   {
      Configuration config = UnitTestConfigurationFactory.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, getClass());
   }
View Full Code Here

      isTrue = true;
   }

   void initCaches() throws Exception
   {
      Configuration conf = UnitTestConfigurationFactory.createConfiguration(Configuration.CacheMode.LOCAL, true);
      EvictionConfig evConfig = new EvictionConfig(new EvictionRegionConfig(Fqn.ROOT, new ElementSizeAlgorithmConfig(5000, 100), 200000), -1);
      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, getClass());
      cache.getConfiguration().setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
      cache.getConfiguration().setIsolationLevel(IsolationLevel.SERIALIZABLE);
      cache.start();
   }
View Full Code Here

      EvictionConfig evictConfig = new EvictionConfig();
      evictConfig.setDefaultEvictionRegionConfig(evictionRegionConfig);
      evictConfig.setWakeupInterval(wakeupInterval);


      Configuration config = new Configuration();
      config.setCacheMode(Configuration.CacheMode.LOCAL);
      config.setEvictionConfig(evictConfig);

      cache = factory.createCache(config, true);

      ServerCacheHitInterceptor hit = new ServerCacheHitInterceptor(this);
      ServerCacheInterceptor interceptor = new ServerCacheInterceptor(this);
View Full Code Here

                        LOG.debug(e.getMessage(), e);
                    }
                }
            }
        } else {
            Configuration configuration = new Configuration();
            EvictionRegionConfig evictionRegionConfig = new EvictionRegionConfig(Fqn.root());
            ExpirationAlgorithmConfig expirationAlgorithm = new ExpirationAlgorithmConfig();
            int maxCacheSize = getIntConfigurationValue(facesContext, CoreConfiguration.Items.resourcesCacheSize);
            expirationAlgorithm.setMaxNodes(maxCacheSize);

            evictionRegionConfig.setEvictionAlgorithmConfig(expirationAlgorithm);

            EvictionConfig evictionConfig = new EvictionConfig(evictionRegionConfig);

            evictionConfig.setWakeupInterval(1000);
            configuration.setEvictionConfig(evictionConfig);
            cache = cacheFactory.createCache(configuration);
        }

        return new JBossCacheCache(cache);
    }
View Full Code Here

      if (caches == null)
      {
         caches = new HashMap<ConfigurationKey, Cache>();
         allCacheTypes.put(cacheType, caches);
      }
      Configuration cfg = cache.getConfiguration();
      ConfigurationKey key;
      try
      {
         key = new ConfigurationKey(cfg);
      }
View Full Code Here

         assertEquals(CacheStatus.INSTANTIATED, cache.getCacheStatus());
         cache.create();
         cache.start();

         // Config should be a clone
         Configuration rawConfig = configRegistry.getConfiguration(configName);
         Configuration realConfig = cache.getConfiguration();
         assertFalse(rawConfig == realConfig);
         assertEquals(rawConfig.getClusterName(), realConfig.getClusterName());
      }

      cacheNames = registry.getCacheNames();
      assertEquals(configNames, cacheNames);
View Full Code Here

      this.rpcManager = manager;

      trace = log.isTraceEnabled();

      // what sort of a repl processor do we need?
      Configuration c = componentRegistry.getComponent(Configuration.class);
      this.configuration = c;
      replicationProcessor = c.getRuntimeConfig().getAsyncSerializationExecutor();
      if (c.getCacheMode().isSynchronous() ||
            (replicationProcessor == null && c.getSerializationExecutorPoolSize() < 1) || requireSyncMarshalling(c)) // if an executor has not been injected and the pool size is set
      {
         // in-process thread.  Not async.
         replicationProcessor = new WithinThreadExecutor();
         asyncSerial = false;
      }
      else
      {
         asyncSerial = true;
         if (replicationProcessor == null)
         {
            replicationProcessorCount = new AtomicInteger(0);

            replicationProcessor = BoundedExecutors.newFixedThreadPool(c.isUseReplQueue() ? 1 : c.getSerializationExecutorPoolSize(),
                  new ThreadFactory()
                  {
                     public Thread newThread(Runnable r)
                     {
                        return new Thread(r, "AsyncReplicationProcessor-" + replicationProcessorCount.incrementAndGet());
                     }
                  }, c.getSerializationExecutorQueueSize()
            );
         }
      }
   }
View Full Code Here

            throw new IllegalStateException("Cannot create PojoCache: plain cache already created for config " + configName);
        
         cache = pojoCaches.get(configName);
         if (cache == null && create)
         {
            Configuration config = getConfigurationRegistry().getConfiguration(configName);
            if (getChannelFactory() != null && config.getMultiplexerStack() != null)
            {
               config.getRuntimeConfig().setMuxChannelFactory(getChannelFactory());
            }
            cache = createPojoCache(config);
            registerPojoCache(cache, configName);
         }
         else if (cache != null)
View Full Code Here

TOP

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

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.