Package org.jboss.cache.config

Examples of org.jboss.cache.config.CacheLoaderConfig


{
   protected void configureCache(CacheSPI cache) throws Exception
   {
      // use the shared variation of the DIMCL so that state is persisted in a static variable in memory rather than an
      // instance one.
      CacheLoaderConfig clc = UnitTestConfigurationFactory.buildSingleCacheLoaderConfig(false, "", DummySharedInMemoryCacheLoader.class.getName(),
            "debug=true \n bin=" + getClass().getName(), false, true, false, false, false);
      cache.getConfiguration().setCacheLoaderConfig(clc);
      cache.getConfiguration().setNodeLockingScheme(NodeLockingScheme.PESSIMISTIC);
   }
View Full Code Here


                  "                      purgeOnStartup=\"false\">\n" +
                  "                <properties>bin=" + getClass()+ "bin2</properties>\n" +
                  "         </loader>" +
                  "      </loaders>";
      LoadersElementParser parser = new LoadersElementParser();
      CacheLoaderConfig cacheLoaderConfig = parser.parseLoadersElement(XmlConfigHelper.stringToElementInCoreNS(xml));
      Configuration c = cache.getConfiguration();
      c.setCacheLoaderConfig(cacheLoaderConfig);
      cache.start();

      cache.put(fqn, key, value);
View Full Code Here

      cache.getConfiguration().setNodeLockingScheme(NodeLockingScheme.MVCC);
      cache.getConfiguration().setIsolationLevel(IsolationLevel.READ_COMMITTED);

      String binName = "bin-" + Thread.currentThread().getName();

      CacheLoaderConfig clc = UnitTestConfigurationFactory.buildSingleCacheLoaderConfig(false, "", DummySharedInMemoryCacheLoader.class.getName(),
            "debug=true\nbin=" + binName, false, true, false, false, false);
      clc.setPassivation(true);
      cache.getConfiguration().setCacheLoaderConfig(clc);
   }
View Full Code Here

   }

   protected CacheLoaderConfig getCacheLoaderConfig(String loc1, String loc2) throws Exception
   {
      CacheLoaderConfig clc = new CacheLoaderConfig();
      // clc 1
      IndividualCacheLoaderConfig iclc = new IndividualCacheLoaderConfig();
      iclc.setClassName(DummySharedInMemoryCacheLoader.class.getName());
      iclc.setAsync(false);
      iclc.setFetchPersistentState(true);
      iclc.setPurgeOnStartup(false);
      iclc.setIgnoreModifications(false);
      iclc.setProperties("bin=" + loc1);
      clc.addIndividualCacheLoaderConfig(iclc);

      IndividualCacheLoaderConfig iclc2 = iclc.clone();
      iclc2.setFetchPersistentState(false);
      iclc2.setProperties("bin=" + loc2);
      clc.addIndividualCacheLoaderConfig(iclc2);
      clc.setPassivation(false);
      clc.setShared(false);
      return clc;
   }
View Full Code Here

      p.setProperty("cache.jdbc.table.name", prop.getProperty("cache.jdbc.table.name"));
      p.setProperty("cache.jdbc.table.primarykey", prop.getProperty("cache.jdbc.table.primarykey"));
      JDBCCacheLoaderConfig jdbcConfig = new JDBCCacheLoaderConfig();
      jdbcConfig.setFetchPersistentState(true);
      jdbcConfig.setProperties(p);
      CacheLoaderConfig config = new CacheLoaderConfig();
      config.addIndividualCacheLoaderConfig(jdbcConfig);
      cache.getConfiguration().setCacheLoaderConfig(config);
      cache.create();
   }
View Full Code Here

   }


   public Cache<String, String> init(boolean passivation) throws Exception
   {
      CacheLoaderConfig cacheLoaderConfig = UnitTestConfigurationFactory.buildSingleCacheLoaderConfig(passivation, "", DummyInMemoryCacheLoader.class.getName(), "", false, true, false, false, false);
      Configuration cfg = new Configuration();
      cfg.setNodeLockingScheme(getNodeLockingScheme());
      cfg.setCacheLoaderConfig(cacheLoaderConfig);
      cfg.getRuntimeConfig().setTransactionManager(new DummyTransactionManager());
      Cache<String, String> cache = new UnitTestCacheFactory().createCache(cfg, getClass());
View Full Code Here

      return new ActiveStatusModifier(mscl);
   }

   protected CacheLoaderConfig getSingletonStoreCacheLoaderConfig(String cacheloaderClass, boolean isPush) throws Exception
   {
      CacheLoaderConfig clc = UnitTestConfigurationFactory.buildSingleCacheLoaderConfig(false, null, cacheloaderClass, "", false, false, false, false, false);
      CacheLoaderConfig.IndividualCacheLoaderConfig.SingletonStoreConfig sc = new CacheLoaderConfig.IndividualCacheLoaderConfig.SingletonStoreConfig();
      sc.setSingletonStoreEnabled(true);
      sc.setProperties("pushStateWhenCoordinator = " + isPush + "\n pushStateWhenCoordinatorTimeout = 50000\n");
      clc.getFirstCacheLoaderConfig().setSingletonStoreConfig(sc);
      return clc;
   }
View Full Code Here

      return clc;
   }

   protected CacheLoaderConfig getSingletonStoreCacheLoaderConfig(String cacheloaderClass, String singletonStoreClass) throws Exception
   {
      CacheLoaderConfig clc = UnitTestConfigurationFactory.buildSingleCacheLoaderConfig(false, null, cacheloaderClass, "", false, false, false, false, false);
      CacheLoaderConfig.IndividualCacheLoaderConfig.SingletonStoreConfig sc = new CacheLoaderConfig.IndividualCacheLoaderConfig.SingletonStoreConfig();
      sc.setSingletonStoreEnabled(true);
      sc.setSingletonStoreClass(singletonStoreClass);
      sc.setProperties("pushStateWhenCoordinator = true\n pushStateWhenCoordinatorTimeout = 50000\n");
      clc.getFirstCacheLoaderConfig().setSingletonStoreConfig(sc);
      return clc;
   }
View Full Code Here

{
   private LoadersElementParser loadersElementParser = new LoadersElementParser();

   private CacheLoaderConfig createCacheLoaderCfg(boolean passivation)
   {
      CacheLoaderConfig cfg = new CacheLoaderConfig();
      cfg.setPassivation(passivation);
      return cfg;
   }
View Full Code Here

   public void testSingleCacheLoader() throws Exception
   {
      // without async
      CacheLoaderManager mgr = new CacheLoaderManager();
      CacheLoaderConfig cfg = createCacheLoaderCfg(false);
      cfg.addIndividualCacheLoaderConfig(createIndividualCacheLoaderConfig(cfg, false, "org.jboss.cache.loader.FileCacheLoader"));

      mgr.setConfig(cfg, null, null);
      CacheLoader cl = mgr.getCacheLoader();

      assertEquals(FileCacheLoader.class, cl.getClass());

      // with async
      cfg = createCacheLoaderCfg(false);
      cfg.addIndividualCacheLoaderConfig(createIndividualCacheLoaderConfig(cfg, true, "org.jboss.cache.loader.FileCacheLoader"));

      mgr.setConfig(cfg, null, null);
      cl = mgr.getCacheLoader();

      assertEquals(AsyncCacheLoader.class, cl.getClass());
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.