@Override public String getName() { GlobalConfiguration global = this.cache.getCacheManager().getCacheManagerConfiguration(); TransportConfiguration transport = global.transport(); return transport.transport() != null ? transport.clusterName() : global.globalJmxStatistics().cacheManagerName(); }
.clusterName(transport.clusterName()) .machineId(transport.machineId()) .rackId(transport.rackId())
@Override public void start() { GlobalConfigurationBuilder builder = new GlobalConfigurationBuilder(); // WFLY-6685 Prevent Infinispan from registering channel mbeans // The JGroups subsystem already does this builder.globalJmxStatistics().read(this.configuration.globalJmxStatistics()).disable(); // ISPN-4755 workaround TransportConfiguration transport = this.configuration.transport(); builder.transport() .clusterName(transport.clusterName()) .distributedSyncTimeout(transport.distributedSyncTimeout()) .initialClusterSize(transport.initialClusterSize()) .initialClusterTimeout(transport.initialClusterTimeout(), TimeUnit.MILLISECONDS) .machineId(transport.machineId()) .nodeName(transport.nodeName()) .rackId(transport.rackId()) .siteId(transport.siteId()) .transport(transport.transport()) .withProperties(transport.properties()) ; this.configuration = builder.build(); super.start(); }
/** * Carry out any initialization tasks that might be necessary */ @Override public void initialize() { cacheManager = new DefaultCacheManager(globalConfiguration, defaultConfiguration, true); if(entryCache == null) { cacheManager.defineConfiguration(LDCACHE_ENTRY_CACHE, defaultConfiguration); entryCache = cacheManager.<String,CacheEntry>getCache(LDCACHE_ENTRY_CACHE).getAdvancedCache().withFlags(Flag.SKIP_LOCKING, Flag.SKIP_CACHE_LOAD, Flag.SKIP_REMOTE_LOOKUP); } log.info("initialised cache manager ({})", globalConfiguration.isClustered() ? "cluster name: "+globalConfiguration.transport().clusterName() : "single host"); }
@CacheStarted public void logCacheManagerStart(final CacheStartedEvent event) { Logger log = LogManager.getLogger("MAIN"); EmbeddedCacheManager cacheManager = event.getCacheManager(); if (!cacheManager.getCacheManagerConfiguration().isClustered()) { // Local Infinispan (no cluster) log.info("[CM8008] Infinispan clustering: not configured"); } else if (clusterInfoLogged.compareAndSet(false, true)) { // Clustered Infinispan, log cluster conf for the first start cache event only // to prevent duplicate log lines with same cluster info log.info("[CM8007] Infinispan status: {}", cacheManager.getStatus()); log.info("[CM8009] Infinispan cluster name: {}", cacheManager.getCacheManagerConfiguration().transport().clusterName()); log.info("[CM8010] Infinispan cluster local node logical address: {}", cacheManager.getAddress()); log.info("[CM8019] Infinispan cluster local node physical address(es): {}", cacheManager.getCacheManagerConfiguration().transport().transport().getPhysicalAddresses()); log.info("[CM8011] Infinispan cluster coordinator logical address: {}", cacheManager.getCoordinator()); log.info("[CM8016] Infinispan cluster local node is coordinator: {}", cacheManager.isCoordinator()); log.info("[CM8012] Infinispan cluster members: {}", cacheManager.getMembers()); log.info("[CM8013] Infinispan cluster distributed sync timeout: {}", cacheManager.getCacheManagerConfiguration().transport().distributedSyncTimeout()); log.info("[CM8014] Infinispan cluster JGroups configuration file: {}", cacheManager.getCacheManagerConfiguration().transport().properties().getProperty("configurationFile")); } final Date now = new Date(); log.info("[CM8006] Started Infinispan {} cache {} in {} ms", cacheManager.getCacheConfiguration(event.getCacheName()).clustering().cacheModeString(), event.getCacheName(), now.getTime() - initiationTimestamp.getTime()); } }
/** * If some JGoups properties has been set, it will load the configuration and set * the cluster name by adding as suffix the name of the {@link ExoContainerContext} * * @param config the global configuration from which the JGroups config will be extracted * @param configBuilder the related configuration builder * @throws ExoCacheInitException if any exception occurs while configuring JGroups */ private void configureJGroups(GlobalConfiguration config, GlobalConfigurationBuilder configBuilder) throws ExoCacheInitException { if (loadJGroupsConfig(config, configBuilder)) { // The JGroups Config could be loaded which means that the configuration is for a cluster configBuilder.transport().clusterName(config.transport().clusterName() + "-" + ctx.getName()); } }
@Override public String getName() { GlobalConfiguration global = this.cache.getCacheManager().getCacheManagerConfiguration(); TransportConfiguration transport = global.transport(); return transport.transport() != null ? transport.clusterName() : global.globalJmxStatistics().cacheManagerName(); }
mappingGlobalConfigCacheManager.get(gc.transport().clusterName()); if (currentCacheManager == null) mappingGlobalConfigCacheManager.put(gc.transport().clusterName(), currentCacheManager);
mappingGlobalConfigCacheManager.put(cacheManager.getCacheManagerConfiguration().transport().clusterName(), cacheManager); return cacheManager;
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); } } }
cacheManager = new DefaultCacheManager(globalConfiguration, defaultConfiguration, true); log.info("initialised Infinispan replicated cache manager (cluster name: {})", globalConfiguration.transport().clusterName());
cacheManager = new DefaultCacheManager(globalConfiguration, defaultConfiguration, true); log.info("initialised Infinispan distributed cache manager (cluster name: {})", globalConfiguration.transport().clusterName());
ExoContainer container = ExoContainerContext.getCurrentContainer(); configBuilder.transport().clusterName(gc.transport().clusterName() + "_" + container.getContext().getName()) .globalJmxStatistics() .cacheManagerName(gc.globalJmxStatistics().cacheManagerName() + "_" + container.getContext().getName()). EmbeddedCacheManager manager; gc = configBuilder.build(); String clusterName = gc.transport().clusterName(); if (CACHE_MANAGERS.containsKey(clusterName))
@Override public void call() { GlobalConfiguration globalCfg = cm.getCacheManagerConfiguration(); assertTrue(globalCfg.transport().transport() instanceof JGroupsTransport); assertEquals("demoCluster", globalCfg.transport().clusterName()); Configuration cfg = cm.getDefaultCacheConfiguration(); assertEquals(CacheMode.REPL_SYNC, cfg.clustering().cacheMode()); }
.clusterName(transport.clusterName()) .machineId(transport.machineId()) .rackId(transport.rackId())
@Override public void start() { GlobalConfigurationBuilder builder = new GlobalConfigurationBuilder(); // WFLY-6685 Prevent Infinispan from registering channel mbeans // The JGroups subsystem already does this builder.globalJmxStatistics().read(this.configuration.globalJmxStatistics()).disable(); // ISPN-4755 workaround TransportConfiguration transport = this.configuration.transport(); builder.transport() .clusterName(transport.clusterName()) .distributedSyncTimeout(transport.distributedSyncTimeout()) .initialClusterSize(transport.initialClusterSize()) .initialClusterTimeout(transport.initialClusterTimeout(), TimeUnit.MILLISECONDS) .machineId(transport.machineId()) .nodeName(transport.nodeName()) .rackId(transport.rackId()) .siteId(transport.siteId()) .transport(transport.transport()) .withProperties(transport.properties()) ; this.configuration = builder.build(); super.start(); }
assertEquals("infinispan-cluster", gc.transport().clusterName()); assertEquals("Jalapeno", gc.transport().nodeName()); assertEquals(50000, gc.transport().distributedSyncTimeout());
assertEquals("maximal-cluster", g.transport().clusterName()); assertEquals(120000, g.transport().distributedSyncTimeout()); assertEquals("udp", g.transport().properties().getProperty("stack-udp"));