GlobalConfiguration globalConfiguration = GlobalConfiguration.getClusteredDefault();
globalConfiguration.setExposeGlobalJmxStatistics(true);
globalConfiguration.setAllowDuplicateDomains(true);
globalConfiguration.setMBeanServerLookup(PerThreadMBeanServerLookup.class.getName());
globalConfiguration.setJmxDomain(JMX_DOMAIN);
EmbeddedCacheManager cacheManager1 = TestCacheManagerFactory.createCacheManagerEnforceJmxDomain(globalConfiguration);
registerCacheManager(cacheManager1);
GlobalConfiguration globalConfiguration2 = globalConfiguration.clone();
globalConfiguration2.setCacheManagerName("SecondDefaultCacheManager");
EmbeddedCacheManager cacheManager2 = TestCacheManagerFactory.createCacheManagerEnforceJmxDomain(globalConfiguration2);
registerCacheManager(cacheManager2);
Configuration configuration = getDefaultClusteredConfig(Configuration.CacheMode.REPL_SYNC, true);
configuration.setExposeJmxStatistics(true);
cacheManager1.defineConfiguration("test", configuration);
cacheManager2.defineConfiguration("test", configuration.clone());
cache1 = cacheManager1.getCache("test");
cache2 = cacheManager2.getCache("test");
txInterceptor = getCacheObjectName(JMX_DOMAIN, "test(repl_sync)", "Transactions");
txInterceptor2 = getCacheObjectName(JMX_DOMAIN, "test(repl_sync)", "Transactions", "SecondDefaultCacheManager");
threadMBeanServer = PerThreadMBeanServerLookup.getThreadMBeanServer();
tm = TestingUtil.getTransactionManager(cache1);