Package org.jboss.cache.config

Examples of org.jboss.cache.config.CacheLoaderConfig


      LocalDelegatingCacheLoaderConfig cfg = new LocalDelegatingCacheLoaderConfig();
      cfg.setDelegate(delegating_cache);
      cfg.setAsync(false);
      cfg.setFetchPersistentState(false);
      CacheLoaderConfig cacheLoaderConfig = new CacheLoaderConfig();
      cacheLoaderConfig.addIndividualCacheLoaderConfig(cfg);
      cacheLoaderConfig.setPassivation(true);
      CacheSPI<Object, Object> cache = cacheTL.get();
      cache.getConfiguration().setCacheLoaderConfig(cacheLoaderConfig);
   }
View Full Code Here


   {
      tearDown();
      cache1 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.REPL_SYNC), false);
      cache2 = (CacheSPI<Object, Object>) new UnitTestCacheFactory<Object, Object>().createCache(UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.REPL_SYNC), false);

      CacheLoaderConfig clc = new CacheLoaderConfig();
      CacheLoaderConfig.IndividualCacheLoaderConfig iclc = new CacheLoaderConfig.IndividualCacheLoaderConfig();
      iclc.setClassName(DummyInMemoryCacheLoader.class.getName());
      clc.addIndividualCacheLoaderConfig(iclc);
      cache1.getConfiguration().setCacheLoaderConfig(clc);
      cache2.getConfiguration().setCacheLoaderConfig(clc.clone());
      cache1.getConfiguration().setUseLazyDeserialization(true);
      cache2.getConfiguration().setUseLazyDeserialization(true);

      cache1.start();
      cache2.start();
View Full Code Here

      cache = null;
   }

   protected CacheLoaderConfig getCacheLoaderConfig(boolean ignoreMods1, boolean ignoreMods2) throws Exception
   {
      CacheLoaderConfig clc = UnitTestCacheConfigurationFactory.buildSingleCacheLoaderConfig(false, null, DummyInMemoryCacheLoader.class.getName(), "", false, true, false, false, ignoreMods1);
      CacheLoaderConfig.IndividualCacheLoaderConfig ic = UnitTestCacheConfigurationFactory.buildIndividualCacheLoaderConfig(null, DummyInMemoryCacheLoader.class.getName(), "", false, false, false, ignoreMods2);
      clc.addIndividualCacheLoaderConfig(ic);
      return clc;
   }
View Full Code Here

      CacheLoaderConfig.IndividualCacheLoaderConfig iclc = new CacheLoaderConfig.IndividualCacheLoaderConfig();
      iclc.setClassName(DummySharedInMemoryCacheLoader.class.getName());
      Properties props = new Properties();
      props.setProperty("bin", "bin-" + Thread.currentThread().getName());
      iclc.setProperties(props);
      CacheLoaderConfig clc = new CacheLoaderConfig();     
      clc.addIndividualCacheLoaderConfig(iclc);     
      cache.getConfiguration().setCacheLoaderConfig(clc);
      // disable state transfer!!
      cache.getConfiguration().setFetchInMemoryState(false);

      cache.start();
View Full Code Here

      CacheSPI<Object, Object> cache = cacheTL.get();
     
      // use the shared variation of the DIMCL so that state is persisted in a static variable in memory rather than an
      // instance one.           
      String bin = "DummyInMemoryCacheLoader-" + Thread.currentThread().getName();
      CacheLoaderConfig clc = getSingleCacheLoaderConfig("", DummySharedInMemoryCacheLoader.class.getName(), "bin=" + bin, false, true, false);
      cache.getConfiguration().setCacheLoaderConfig(clc);
   }
View Full Code Here

   {
      Configuration c = new Configuration();
      c.setIsolationLevel(IsolationLevel.REPEATABLE_READ);
      c.setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());

      CacheLoaderConfig clc = new CacheLoaderConfig();
      IndividualCacheLoaderConfig iclc = new IndividualCacheLoaderConfig();
      iclc.setClassName(DummyInMemoryCacheLoader.class.getName());
      clc.addIndividualCacheLoaderConfig(iclc);
      clc.setPassivation(true);

      c.setCacheLoaderConfig(clc);
      cache = new UnitTestCacheFactory<Object, Object>().createCache(c);
      eventLog.events.clear();
      cache.addCacheListener(eventLog);
View Full Code Here

   Set<Exception> exceptions = new HashSet<Exception>();

   @BeforeTest
   public void setUp() throws Exception
   {
      CacheLoaderConfig cacheLoaderConfig = getSingleCacheLoaderConfig("", DummyInMemoryCacheLoader.class.getName(), "", false, false, false);
      Configuration cfg = new Configuration();
      cfg.setCacheLoaderConfig(cacheLoaderConfig);
      cache = new UnitTestCacheFactory<String, String>().createCache(cfg);
      cache.put(fqn, key, "value");
   }
View Full Code Here

      lruAlgorithmConfig.setTimeToLive(1000000);
      erc.setEvictionAlgorithmConfig(lruAlgorithmConfig);
      ec.addEvictionRegionConfig(erc);
      config.setEvictionConfig(ec);

      CacheLoaderConfig clc = new CacheLoaderConfig();
      clc.setPassivation(true);
      clc.setShared(false);
      FileCacheLoaderConfig fclc = new FileCacheLoaderConfig();
      fclc.setLocation(tmpDir);

      clc.setIndividualCacheLoaderConfigs(Collections.<IndividualCacheLoaderConfig>singletonList(fclc));
      config.setCacheLoaderConfig(clc);

      return cache;
   }
View Full Code Here

    * This methods adds programmatically the required {@link CacheLoader} needed to prevent
    * any {@link TimeoutException}
    */
   private void addCacheLoader()
   {
      CacheLoaderConfig config = cache.getConfiguration().getCacheLoaderConfig();
      List<IndividualCacheLoaderConfig> oldConfigs;
      if (config == null || (oldConfigs = config.getIndividualCacheLoaderConfigs()) == null || oldConfigs.isEmpty())
      {
         if (LOG.isInfoEnabled())
         {
            LOG.info("No cache loader has been defined, thus no need to encapsulate any cache loader.");
         }
         return;
      }
      CacheLoaderManager clm =
         ((CacheSPI<Serializable, Object>)cache).getComponentRegistry().getComponent(CacheLoaderManager.class);
      if (clm == null)
      {
         LOG.error("The CacheLoaderManager cannot be found");
         return;
      }
      CacheLoader currentCL = clm.getCacheLoader();
      if (currentCL == null)
      {
         LOG.error("The CacheLoader cannot be found");
         return;
      }

      ControllerCacheLoader ccl = new ControllerCacheLoader(currentCL);
      List<IndividualCacheLoaderConfig> newConfig = new ArrayList<IndividualCacheLoaderConfig>(1);
      // create CacheLoaderConfig
      IndividualCacheLoaderConfig cclConfig = new IndividualCacheLoaderConfig();
      // set CacheLoader
      cclConfig.setCacheLoader(ccl);
      // set parameters
      cclConfig.setFetchPersistentState(clm.isFetchPersistentState());
      cclConfig.setAsync(false);
      cclConfig.setIgnoreModifications(false);
      CacheLoaderConfig.IndividualCacheLoaderConfig first = config.getFirstCacheLoaderConfig();
      cclConfig.setPurgeOnStartup(first != null && first.isPurgeOnStartup());
      newConfig.add(cclConfig);
      config.setIndividualCacheLoaderConfigs(newConfig);

      if (LOG.isInfoEnabled())
      {
         LOG.info("The configured cache loader has been encapsulated successfully");
      }
View Full Code Here

      individualCacheLoaderConfig.setFetchPersistentState(false);
      individualCacheLoaderConfig.setAsync(false);
      individualCacheLoaderConfig.setIgnoreModifications(false);
      individualCacheLoaderConfig.setPurgeOnStartup(false);
      // create CacheLoaderConfig
      CacheLoaderConfig cacheLoaderConfig = new CacheLoaderConfig();
      cacheLoaderConfig.setShared(false);
      cacheLoaderConfig.setPassivation(false);
      cacheLoaderConfig.addIndividualCacheLoaderConfig(individualCacheLoaderConfig);
      // insert CacheLoaderConfig
      this.cache.getConfiguration().setCacheLoaderConfig(cacheLoaderConfig);
      this.cache.create();
      this.cache.start();
      // start will invoke cache listener which will notify handler that mode is changed
View Full Code Here

TOP

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

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.