Package org.infinispan.manager

Examples of org.infinispan.manager.CacheManager


   }

   protected CacheManager createCacheManager(Properties properties) throws CacheException {
      try {
         String configLoc = PropertiesHelper.getString(INFINISPAN_CONFIG_RESOURCE_PROP, properties, DEF_INFINISPAN_CONFIG_RESOURCE);
         CacheManager manager = new DefaultCacheManager(configLoc, false);
         String globalStats = PropertiesHelper.extractPropertyValue(INFINISPAN_GLOBAL_STATISTICS_PROP, properties);
         if (globalStats != null) {
            manager.getGlobalConfiguration().setExposeGlobalJmxStatistics(Boolean.parseBoolean(globalStats));
         }
         manager.start();
         return manager;
      } catch (IOException e) {
         throw new CacheException("Unable to create default cache manager", e);
      }
   }
View Full Code Here


      GlobalConfiguration myGlobalConfig = new GlobalConfiguration();
      // org.infinispan:cache-name=[global],jmx-resource=CacheManager
      myGlobalConfig.setJmxDomain("org.infinispan");
      myGlobalConfig.setExposeGlobalJmxStatistics(true);
      CacheManager manager = new DefaultCacheManager(myGlobalConfig);

      // org.infinispan:cache-name=myCustomcache(local),jmx-resource=CacheMgmgtInterceptor
      // org.infinispan:cache-name=myCustomcache(local),jmx-resource=MvccLockManager
      // org.infinispan:cache-name=myCustomcache(local),jmx-resource=TxInterceptor

      Configuration config = new Configuration();
      config.setExposeJmxStatistics(true);
      config.setEvictionMaxEntries(123);
      config.setExpirationMaxIdle(180000);
     
      manager.defineCache(MY_CUSTOM_CACHE, config);
      Cache<String,String> cache = manager.getCache(MY_CUSTOM_CACHE);

      cache.put("myKey", "myValue");

      int i = 0;
      while (i < Integer.MAX_VALUE) {
View Full Code Here

         }
      }
   }

   private void removeInMemoryData(Cache cache) {
      CacheManager mgr = cache.getCacheManager();
      Address a = mgr.getAddress();
      String str;
      if (a == null)
         str = "a non-clustered cache manager";
      else
         str = "a cache manager at address " + a;
View Full Code Here

   public void setUp() {
      Configuration c = new Configuration();
      // these 2 need to be set to use the AtomicMapCache
      c.setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
      c.setInvocationBatchingEnabled(true);
      CacheManager cm = TestCacheManagerFactory.createCacheManager(c);
      Cache basicCache = cm.getCache();
      cache = (AtomicMapCache<String, String>) basicCache;
      tm = TestingUtil.getTransactionManager(cache);
   }
View Full Code Here

      config.setUseLockStriping(false); // reduces the odd chance of a key collision and deadlock
      config.setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
   }

   protected CacheManager createCacheManager() {
      CacheManager cm = addClusterEnabledCacheManager();
      cm.defineCache(cacheName, config.clone());
      return cm;
   }
View Full Code Here

      // Pause to give caches time to see each other
      TestingUtil.blockUntilViewsReceived(60000, cache1, cache2);
      verifyInitialData(cache2);

      final CacheManager cm3 = createCacheManager();
      final CacheManager cm4 = createCacheManager();

      Thread t1 = new Thread(new Runnable() {
         public void run() {
            cm3.getCache(cacheName);
         }
      });
      t1.setName("CacheStarter-Cache3");
      t1.start();

      Thread t2 = new Thread(new Runnable() {
         public void run() {
            cm4.getCache(cacheName);
         }
      });
      t2.setName("CacheStarter-Cache4");
      t2.start();

      t1.join();
      t2.join();

      cache3 = cm3.getCache(cacheName);
      cache4 = cm4.getCache(cacheName);

      TestingUtil.blockUntilViewsReceived(120000, cache1, cache2, cache3, cache4);
      verifyInitialData(cache3);
      verifyInitialData(cache4);
      log.info("testConcurrentStateTransfer end - " + testCount);
View Full Code Here

      Configuration cfg = new Configuration();
      cfg.setEvictionStrategy(getEvictionStrategy());
      cfg.setEvictionWakeUpInterval(100);
      cfg.setEvictionMaxEntries(1); // 1 max entries
      cfg.setUseLockStriping(false); // to minimise chances of deadlock in the unit test
      CacheManager cm = TestCacheManagerFactory.createCacheManager(cfg);
      cache = cm.getCache();
      return cm;
   }
View Full Code Here

      Configuration c = new Configuration();
      c.setLockAcquisitionTimeout(500);
      // these 2 need to be set to use the AtomicMapCache
      c.setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
      c.setInvocationBatchingEnabled(true);
      CacheManager cm = TestCacheManagerFactory.createCacheManager(c);
      Cache basicCache = cm.getCache();
      cache = (AtomicMapCache<String, String>) basicCache;
      tm = TestingUtil.getTransactionManager(cache);
   }
View Full Code Here

   private Cache cache1;
   private Cache cache2;
   private CacheStore cs2;

   protected void createCacheManagers() throws Throwable {
      CacheManager cacheManager1 = TestCacheManagerFactory.createClusteredCacheManager();
      CacheManager cacheManager2 = TestCacheManagerFactory.createClusteredCacheManager();
      registerCacheManager(cacheManager1, cacheManager2);

      Configuration config1 = getDefaultClusteredConfig(Configuration.CacheMode.INVALIDATION_SYNC);
      ClusterCacheLoaderConfig clusterClc = new ClusterCacheLoaderConfig();
      CacheLoaderManagerConfig clMngrConfig = new CacheLoaderManagerConfig();
      clMngrConfig.addCacheLoaderConfig(clusterClc);
      config1.setCacheLoaderManagerConfig(clMngrConfig);

      Configuration config2 = getDefaultClusteredConfig(Configuration.CacheMode.INVALIDATION_SYNC);
      CacheLoaderManagerConfig clMngrConfig2 = clMngrConfig.clone();//this also includes the clustered CL
      clMngrConfig2.addCacheLoaderConfig(new DummyInMemoryCacheStore.Cfg());
      assert clMngrConfig2.getCacheLoaderConfigs().size() == 2;
      config2.setCacheLoaderManagerConfig(clMngrConfig2);


      cacheManager1.defineCache("clusteredCl", config1);
      cacheManager2.defineCache("clusteredCl", config2);
      cache1 = cache(0, "clusteredCl");
      cache2 = cache(1, "clusteredCl");
      CacheLoaderManager manager2 = cache2.getAdvancedCache().getComponentRegistry().getComponent(CacheLoaderManager.class);
      ChainingCacheStore chainingCacheStore = (ChainingCacheStore) manager2.getCacheStore();
      cs2 = chainingCacheStore.getStores().keySet().iterator().next();
View Full Code Here

      GlobalConfiguration globalConfiguration = GlobalConfiguration.getClusteredDefault();
      globalConfiguration.setExposeGlobalJmxStatistics(true);
      globalConfiguration.setAllowDuplicateDomains(true);
      globalConfiguration.setJmxDomain(JMX_DOMAIN);
      globalConfiguration.setMBeanServerLookup(PerThreadMBeanServerLookup.class.getName());
      CacheManager cacheManager1 = TestCacheManagerFactory.createCacheManager(globalConfiguration);
      cacheManager1.start();

      GlobalConfiguration globalConfiguration2 = GlobalConfiguration.getClusteredDefault();
      globalConfiguration2.setExposeGlobalJmxStatistics(true);
      globalConfiguration2.setMBeanServerLookup(PerThreadMBeanServerLookup.class.getName());
      globalConfiguration2.setJmxDomain(JMX_DOMAIN);
      globalConfiguration2.setAllowDuplicateDomains(true);
      CacheManager cacheManager2 = TestCacheManagerFactory.createCacheManager(globalConfiguration2);
      cacheManager2.start();

      registerCacheManager(cacheManager1, cacheManager2);

      Configuration config = getDefaultClusteredConfig(Configuration.CacheMode.REPL_SYNC);
      config.setExposeJmxStatistics(true);
View Full Code Here

TOP

Related Classes of org.infinispan.manager.CacheManager

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.