private GlobalConfiguration getGlobalConfiguration() { GlobalConfigurationBuilder builder = new GlobalConfigurationBuilder(); return builder.read(getWebCacheManager().getCacheManagerConfiguration()) .classLoader(Thread.currentThread().getContextClassLoader()) .transport().clusterName("wboss") .build(); } }
globalConfigurationBuilder.read(infinispanGlobalConfigurer.getGlobalConfiguration()); } else { globalConfigurationBuilder.globalJmxStatistics().jmxDomain(DEFAULT_JMX_DOMAIN).enable();
globalConfigurationBuilder.read(infinispanGlobalConfigurer.getGlobalConfiguration()); } else { globalConfigurationBuilder.globalJmxStatistics().jmxDomain(DEFAULT_JMX_DOMAIN).enable();
protected void createCluster(GlobalConfigurationBuilder globalBuilder, ConfigurationBuilder builder, int count) { for (int i = 0; i < count; i++) addClusterEnabledCacheManager(new GlobalConfigurationBuilder().read(globalBuilder.build()), builder); }
protected EmbeddedCacheManager createBackingEmbeddedCacheManager() throws IOException { if (configurationFileLocation != null) { ConfigurationBuilderHolder configurationBuilderHolder = new ParserRegistry(Thread.currentThread().getContextClassLoader()) .parse(configurationFileLocation.getInputStream()); if(gcb != null) { configurationBuilderHolder.getGlobalConfigurationBuilder().read(gcb.build()); } if (builder != null) { configurationBuilderHolder.getDefaultConfigurationBuilder().read(builder.build()); } return new DefaultCacheManager(configurationBuilderHolder, true); } else { if (gcb == null) { if (logger.isDebugEnabled()) logger.debug("GlobalConfigurationBuilder is null. Using default new " + "instance."); gcb = new GlobalConfigurationBuilder(); gcb.globalJmxStatistics().allowDuplicateDomains(true); } if (builder == null) { if (logger.isDebugEnabled()) logger.debug("ConfigurationBuilder is null. Using default new instance."); builder = new ConfigurationBuilder(); } return new DefaultCacheManager(gcb.build(), builder.build()); } }
protected EmbeddedCacheManager createBackingEmbeddedCacheManager() throws IOException { if (configurationFileLocation != null) { ConfigurationBuilderHolder configurationBuilderHolder = new ParserRegistry(Thread.currentThread().getContextClassLoader()) .parse(configurationFileLocation.getInputStream()); if(gcb != null) { configurationBuilderHolder.getGlobalConfigurationBuilder().read(gcb.build()); } if (builder != null) { ConfigurationBuilder dcb = configurationBuilderHolder.getDefaultConfigurationBuilder(); if (dcb != null) dcb.read(builder.build()); else throw logger.noDefaultCache(); } return new DefaultCacheManager(configurationBuilderHolder, true); } else { if (gcb == null) { if (logger.isDebugEnabled()) logger.debug("GlobalConfigurationBuilder is null. Using default new " + "instance."); gcb = new GlobalConfigurationBuilder(); } if (builder == null) { if (logger.isDebugEnabled()) logger.debug("ConfigurationBuilder is null. Using default new instance."); builder = new ConfigurationBuilder(); } return new DefaultCacheManager(gcb.build(), builder.build()); } }
private JChannel createJGroupsChannel(GlobalConfiguration oldGC) { GlobalConfigurationBuilder builder = new GlobalConfigurationBuilder().read(oldGC); TestCacheManagerFactory.amendTransport(builder); GlobalConfiguration gc = builder.build(); Properties p = gc.transport().properties(); String jgroupsCfg = p.getProperty(JGroupsTransport.CONFIGURATION_STRING); try { JChannel channel = new JChannel(new ByteArrayInputStream(jgroupsCfg.getBytes())); channel.setName(gc.transport().nodeName()); channel.connect(gc.transport().clusterName()); return channel; } catch (Exception e) { throw new CacheException(e); } } }
protected EmbeddedCacheManager addClusterEnabledCacheManager(TransportFlags flags, GlobalConfigurationBuilder gcb, ConfigurationBuilder builder) { GlobalConfigurationBuilder clone = GlobalConfigurationBuilder.defaultClusteredBuilder(); //get the transport here as clone.read below would inject the same transport reference into the clone // which we don't want Transport transport = clone.transport().getTransport(); Marshaller marshaller = clone.serialization().getMarshaller(); clone.read(gcb.build()); clone.transport().transport(transport); clone.serialization().marshaller(marshaller); clone.transport().clusterName("ISPN(SITE " + siteName + ")"); EmbeddedCacheManager cm = TestCacheManagerFactory.createClusteredCacheManager(clone, builder, flags); cacheManagers.add(cm); return cm; }
globalConfigBuilder.read(globalConfigFromXml);
@Override public void call() { EmbeddedCacheManager cm1 = cms[0]; EmbeddedCacheManager cm2 = cms[1]; TestingUtil.waitForNoRebalance(cm1.getCache(), cm2.getCache()); Cache<Object, Object> c1 = cm1.getCache(); GlobalConfiguration globalCfg = cm1.getCacheManagerConfiguration(); Configuration cfg = c1.getCacheConfiguration(); TestingUtil.killCacheManagers(cm1); globalCfg = new GlobalConfigurationBuilder().read(globalCfg).build(); withCacheManager(new CacheManagerCallable( new DefaultCacheManager(globalCfg, cfg)) { @Override public void call() { Cache<Object, Object> c = cm.getCache(); c.put(1, "v1"); assertEquals("v1", c.get(1)); } }); } });