@Override public TransportConfiguration get() { return new GlobalConfigurationBuilder().transport().transport(null).create(); } }
builder.transport().transport(transport.transport()) .distributedSyncTimeout(transport.distributedSyncTimeout()) .clusterName(transport.clusterName()) builder.transport().transportThreadPool().read(this.pools.get(ThreadPoolResourceDefinition.TRANSPORT).get()); builder.transport().remoteCommandThreadPool().read(this.pools.get(ThreadPoolResourceDefinition.REMOTE_COMMAND).get());
@Override public TransportConfiguration get() { ChannelFactory factory = this.factory.get(); ProtocolStackConfiguration stack = factory.getProtocolStackConfiguration(); org.wildfly.clustering.jgroups.spi.TransportConfiguration.Topology topology = stack.getTransport().getTopology(); TransportConfigurationBuilder builder = new GlobalConfigurationBuilder().transport() .clusterName(this.cluster.get()) .distributedSyncTimeout(this.lockTimeout) .transport(new ChannelFactoryTransport(factory)) ; if (topology != null) { builder.siteId(topology.getSite()).rackId(topology.getRack()).machineId(topology.getMachine()); } return builder.create(); }
@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(); }
/** * After having parsed the Infinispan configuration file, we might want to override the specified JGroups * configuration file. * * @param builderHolder * @param transportOverrideResource The alternative JGroups configuration file to be used, or null */ private void patchTransportConfiguration(ConfigurationBuilderHolder builderHolder, String transportOverrideResource) { if (transportOverrideResource != null) { builderHolder.getGlobalConfigurationBuilder().transport().addProperty("configurationFile", transportOverrideResource); } }
@Override public TransportConfiguration get() { return new GlobalConfigurationBuilder().transport().transport(null).create(); } }
public static void setNodeName(GlobalConfigurationBuilder builder) { String nextNodeName = TestResourceTracker.getNextNodeName(); // Set the node name even for local managers in order to set the name of the worker threads builder.transport().nodeName(nextNodeName); }
public static void registerChannel(GlobalConfigurationBuilder gcb, JChannel channel, String nodeName, boolean connect) { TransportConfigurationBuilder tcb = gcb.transport(); tcb.defaultTransport(); tcb.addProperty(JGroupsTransport.CHANNEL_LOOKUP, CustomChannelLookup.class.getName()); tcb.addProperty("customNodeName", nodeName); tcb.addProperty("customConnect", Boolean.toString(connect)); channelMap.put(nodeName, channel); }
@Test(expectedExceptions = CacheConfigurationException.class) public void testClusterNameNull() { GlobalConfigurationBuilder gc = new GlobalConfigurationBuilder(); gc.transport().clusterName(null).build(); }
public static EmbeddedCacheManager createCacheManager(GlobalConfigurationBuilder globalBuilder, ConfigurationBuilder builder, boolean keepJmxDomain) { if (globalBuilder.transport().build().transport().transport() != null) { throw new IllegalArgumentException("Use TestCacheManagerFactory.createClusteredCacheManager(...) for clustered cache managers"); } return newDefaultCacheManager(true, globalBuilder, builder, keepJmxDomain); }
private void updatedSiteInfo(GlobalConfigurationBuilder gcb, String s, String r, String m) { gcb.transport().siteId(s).rackId(r).machineId(m); }
private static void amendTransport(GlobalConfigurationBuilder builder, TransportFlags flags) { String testName = TestResourceTracker.getCurrentTestName(); GlobalConfiguration gc = builder.build(); if (gc.transport().transport() != null) { // Remove any configuration file that might have been set. builder.transport().removeProperty(JGroupsTransport.CONFIGURATION_FILE); builder.transport().addProperty(JGroupsTransport.CONFIGURATION_STRING, getJGroupsConfig(testName, flags)); } }
private GlobalConfigurationBuilder getGlobalConfigurationBuilder() { GlobalConfigurationBuilder globalBuilder = GlobalConfigurationBuilder.defaultClusteredBuilder(); BlockingThreadPoolExecutorFactory threadPoolFactory = new BlockingThreadPoolExecutorFactory(1, 1, 0, Thread.NORM_PRIORITY); globalBuilder.transport().remoteCommandThreadPool().threadPoolFactory(threadPoolFactory); return globalBuilder; }
public static EmbeddedCacheManager createCacheManager(GlobalConfigurationBuilder globalBuilder, ConfigurationBuilder builder) { if (globalBuilder.transport().build().transport().transport() != null) { throw new IllegalArgumentException("Use TestCacheManagerFactory.createClusteredCacheManager(...) for clustered cache managers"); } amendTransport(globalBuilder); return newDefaultCacheManager(true, globalBuilder, builder, false); }
protected EmbeddedCacheManager addClusterEnabledCacheManager(TransportFlags flags) { GlobalConfigurationBuilder gcb = GlobalConfigurationBuilder.defaultClusteredBuilder(); // Amend first so we can increase the transport thread pool TestCacheManagerFactory.amendGlobalConfiguration(gcb, flags); // we need to increase the transport and remote thread pools to default values BlockingThreadPoolExecutorFactory executorFactory = new BlockingThreadPoolExecutorFactory( 25, 25, 10000, 30000); gcb.transport().transportThreadPool().threadPoolFactory(executorFactory); gcb.transport().remoteCommandThreadPool().threadPoolFactory(executorFactory); EmbeddedCacheManager cm = TestCacheManagerFactory.newDefaultCacheManager(true, gcb, new ConfigurationBuilder(), false); cacheManagers.add(cm); return cm; }
protected EmbeddedCacheManager addClusterEnabledCacheManager(TransportFlags flags) { GlobalConfigurationBuilder gcb = GlobalConfigurationBuilder.defaultClusteredBuilder(); // Amend first so we can increase the transport thread pool TestCacheManagerFactory.amendGlobalConfiguration(gcb, flags); // we need to increase the transport and remote thread pools to default values BlockingThreadPoolExecutorFactory executorFactory = new BlockingThreadPoolExecutorFactory( 25, 25, 10000, 30000); gcb.transport().transportThreadPool().threadPoolFactory(executorFactory); gcb.transport().remoteCommandThreadPool().threadPoolFactory(executorFactory); EmbeddedCacheManager cm = TestCacheManagerFactory.newDefaultCacheManager(true, gcb, new ConfigurationBuilder(), false); cacheManagers.add(cm); return cm; }
@Override protected void createCacheManagers() throws Throwable { for (int i = 0; i < CLUSTER_SIZE; i++) { GlobalConfigurationBuilder gc = GlobalConfigurationBuilder.defaultClusteredBuilder(); gc.transport().initialClusterSize(CLUSTER_SIZE).initialClusterTimeout(CLUSTER_TIMEOUT_SECONDS, TimeUnit.SECONDS); cacheManagers.add(TestCacheManagerFactory.createClusteredCacheManager(false, gc, getDefaultClusteredCacheConfig(CacheMode.DIST_SYNC), new TransportFlags().withPortRange(i), false)); } }
public EmbeddedCacheManager createCacheManager(int counter, int siteId, int machineId, int rackId) { ConfigurationBuilder builder = getDefaultClusteredCacheConfig(getCacheMode(), false); GlobalConfigurationBuilder globalConfigurationBuilder = GlobalConfigurationBuilder.defaultClusteredBuilder(); globalConfigurationBuilder.transport().machineId("m" + (machineId > 0 ? machineId : counter)) .rackId("r" + (rackId > 0 ? rackId : counter)).siteId("s" + (siteId > 0 ? siteId : counter)); EmbeddedCacheManager cm1 = TestCacheManagerFactory.createClusteredCacheManager(globalConfigurationBuilder, builder); cm1.defineConfiguration(CACHE_NAME, builder.build()); return cm1; }
@Override protected void createCacheManagers() throws Throwable { cfgBuilder = getDefaultClusteredCacheConfig(CacheMode.DIST_SYNC, true); cfgBuilder.transaction().transactionManagerLookup(new EmbeddedTransactionManagerLookup()); cfgBuilder.clustering().hash().numOwners(2); cfgBuilder.clustering().stateTransfer().fetchInMemoryState(true); cfgBuilder.clustering().stateTransfer().timeout(20000); gcfgBuilder = new GlobalConfigurationBuilder(); gcfgBuilder.transport().transport(mockTransport); }
private EmbeddedCacheManager createCacheManager(String name1, JChannel ch1) { GlobalConfigurationBuilder gcb1 = new GlobalConfigurationBuilder(); gcb1.transport().nodeName(ch1.getName()).distributedSyncTimeout(10, SECONDS); CustomChannelLookup.registerChannel(gcb1, ch1, name1, false); ConfigurationBuilder replCfg = new ConfigurationBuilder(); replCfg.clustering().cacheMode(CacheMode.REPL_SYNC); replCfg.clustering().stateTransfer().timeout(10, SECONDS); EmbeddedCacheManager cm1 = new DefaultCacheManager(gcb1.build(), replCfg.build(), false); registerCacheManager(cm1); cm1.defineConfiguration(CACHE_NAME, replCfg.build()); return cm1; }