} catch (JmxDomainConflictException e) {
}
}
public void testMultipleManagersOnSameServer() throws Exception {
GlobalConfiguration globalConfiguration = GlobalConfiguration.getClusteredDefault();
globalConfiguration.setAllowDuplicateDomains(true);
globalConfiguration.setExposeGlobalJmxStatistics(true);
globalConfiguration.setMBeanServerLookup(PerThreadMBeanServerLookup.class.getName());
cm = TestCacheManagerFactory.createCacheManager(globalConfiguration);
String jmxDomain = globalConfiguration.getJmxDomain();
Configuration localCache = config();//local by default
localCache.setExposeJmxStatistics(true);
cm.defineConfiguration("local_cache", localCache);
cm.getCache("local_cache");
assert existsObject(getCacheObjectName(jmxDomain, "local_cache(local)", "Statistics"));
GlobalConfiguration globalConfiguration2 = GlobalConfiguration.getClusteredDefault();
globalConfiguration2.setExposeGlobalJmxStatistics(true);
globalConfiguration2.setAllowDuplicateDomains(true);
globalConfiguration2.setMBeanServerLookup(PerThreadMBeanServerLookup.class.getName());
cm2 = TestCacheManagerFactory.createCacheManager(globalConfiguration2);
String jmxDomain2 = cm2.getGlobalConfiguration().getJmxDomain();
Configuration localCache2 = config();//local by default
localCache2.setExposeJmxStatistics(true);
cm2.defineConfiguration("local_cache", localCache);
cm2.getCache("local_cache");
assert existsObject(getCacheObjectName(jmxDomain2, "local_cache(local)", "Statistics"));
GlobalConfiguration globalConfiguration3 = GlobalConfiguration.getClusteredDefault();
globalConfiguration3.setExposeGlobalJmxStatistics(true);
globalConfiguration3.setAllowDuplicateDomains(true);
globalConfiguration3.setMBeanServerLookup(PerThreadMBeanServerLookup.class.getName());
cm3 = TestCacheManagerFactory.createCacheManager(globalConfiguration3);
Configuration localCache3 = config();//local by default
localCache3.setExposeJmxStatistics(true);
cm3.defineConfiguration("local_cache", localCache);
cm3.getCache("local_cache");