Package org.infinispan.manager

Examples of org.infinispan.manager.CacheManager


      GlobalConfiguration globalConfiguration = GlobalConfiguration.getClusteredDefault();
      globalConfiguration.setExposeGlobalJmxStatistics(true);
      globalConfiguration.setAllowDuplicateDomains(true);
      globalConfiguration.setMBeanServerLookup(PerThreadMBeanServerLookup.class.getName());
      globalConfiguration.setJmxDomain("TxInterceptorMBeanTest");
      CacheManager cacheManager1 = TestCacheManagerFactory.createCacheManager(globalConfiguration);
      registerCacheManager(cacheManager1);
      CacheManager cacheManager2 = TestCacheManagerFactory.createCacheManager(globalConfiguration.clone());
      registerCacheManager(cacheManager2);

      Configuration configuration = getDefaultClusteredConfig(Configuration.CacheMode.REPL_SYNC);
      configuration.setExposeJmxStatistics(true);
      configuration.setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
      cacheManager1.defineCache("test", configuration);
      cacheManager2.defineCache("test", configuration.clone());
      cache1 = cacheManager1.getCache("test");
      cache2 = cacheManager2.getCache("test");
      txInterceptor = new ObjectName("TxInterceptorMBeanTest:cache-name=test(repl_sync),jmx-resource=Transactions");

      threadMBeanServer = PerThreadMBeanServerLookup.getThreadMBeanServer();
      tm = TestingUtil.getTransactionManager(cache1);
   }
View Full Code Here


      }
      cacheManagers.clear();
   }

   public void testRegisterLocalCache() throws Exception {
      CacheManager cm = TestCacheManagerFactory.createLocalCacheManager();
      cacheManagers.add(cm);
      cm.start();
      Configuration configuration = config();
      configuration.setCacheMode(Configuration.CacheMode.LOCAL);
      cm.defineCache("first", configuration);
      Cache first = cm.getCache("first");

      ComponentsJmxRegistration regComponents = buildRegistrator(first);
      regComponents.registerMBeans();
      String name = regComponents.getObjectName("Statistics");
      ObjectName name1 = new ObjectName(name);
View Full Code Here

   }

   public void testRegisterReplicatedCache() throws Exception {
      GlobalConfiguration globalConfiguration = GlobalConfiguration.getClusteredDefault();
      globalConfiguration.setAllowDuplicateDomains(true);
      CacheManager cm = TestCacheManagerFactory.createCacheManager(globalConfiguration);
      cacheManagers.add(cm);
      cm.start();
      Configuration configurationOverride = config();
      configurationOverride.setCacheMode(Configuration.CacheMode.REPL_SYNC);
      cm.defineCache("first", configurationOverride);
      Cache first = cm.getCache("first");

      ComponentsJmxRegistration regComponents = buildRegistrator(first);
      regComponents.registerMBeans();
      String name = regComponents.getObjectName("Statistics");
      ObjectName name1 = new ObjectName(name);
View Full Code Here

   }

   public void testLocalAndReplicatedCache() throws Exception {
      GlobalConfiguration globalConfiguration = GlobalConfiguration.getClusteredDefault();
      globalConfiguration.setAllowDuplicateDomains(true);
      CacheManager cm = TestCacheManagerFactory.createCacheManager(globalConfiguration);
      cacheManagers.add(cm);
      cm.start();
      Configuration replicated = config();
      Configuration local = config();
      replicated.setCacheMode(Configuration.CacheMode.REPL_SYNC);
      local.setCacheMode(Configuration.CacheMode.LOCAL);
      cm.defineCache("replicated", replicated);
      cm.defineCache("local", local);
      Cache replicatedCache = cm.getCache("replicated");
      Cache localCache = cm.getCache("local");

      ComponentsJmxRegistration replicatedRegComponents = buildRegistrator(replicatedCache);
      ComponentsJmxRegistration localRegComponents = buildRegistrator(localCache);
      replicatedRegComponents.registerMBeans();
      localRegComponents.registerMBeans();
View Full Code Here

   public void setUp() throws Exception {
      // start a single cache instance
      Configuration c = new Configuration();
      c.setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
      c.setInvocationBatchingEnabled(true);
      CacheManager cm = TestCacheManagerFactory.createCacheManager(c);
      cache = new TreeCacheImpl(cm.getCache());
      tm = TestingUtil.getTransactionManager(cache.getCache());
   }
View Full Code Here

   Cache c;

   protected CacheManager createCacheManager() {
      Configuration cfg = new Configuration();
      cfg.setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
      CacheManager cm = TestCacheManagerFactory.createLocalCacheManager();
      cm.defineCache("test", cfg);
      c = cm.getCache("test");
      return cm;
   }
View Full Code Here

   TreeCacheImpl<Object, Object> treeCache;
   TransactionManager tm;
   DataContainer dc;

   protected CacheManager createCacheManager() throws Exception {
      CacheManager cm = TestCacheManagerFactory.createLocalCacheManager();
      Configuration c = new Configuration();
      c.setFetchInMemoryState(false);
      c.setInvocationBatchingEnabled(true);
      c.setLockAcquisitionTimeout(1000);
      cm.defineCache("test", c);
      cache = cm.getCache("test");
      tm = TestingUtil.extractComponent(cache, TransactionManager.class);
      treeCache = new TreeCacheImpl(cache);
      dc = TestingUtil.extractComponent(cache, DataContainer.class);
      return cm;
   }
View Full Code Here

                    throw new RepositorySourceException(name, err);
                }
            }

            // Look for a cache manager in JNDI ...
            CacheManager cacheManager = null;
            String jndiName = getCacheManagerJndiName();
            if (jndiName != null && jndiName.trim().length() != 0) {
                Object object = null;
                try {
                    object = context.lookup(jndiName);
View Full Code Here

                    throw new RepositorySourceException(name, err);
                }
            }

            // Look for a cache manager in JNDI ...
            CacheManager cacheManager = null;
            String jndiName = getCacheManagerJndiName();
            if (jndiName != null && jndiName.trim().length() != 0) {
                Object object = null;
                try {
                    object = context.lookup(jndiName);
View Full Code Here

   }

   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

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.