Search in sources :

Example 1 with TransportConfiguration

use of org.infinispan.configuration.global.TransportConfiguration in project wildfly by wildfly.

the class GlobalConfigurationBuilder method getValue.

@Override
public GlobalConfiguration getValue() {
    org.infinispan.configuration.global.GlobalConfigurationBuilder builder = new org.infinispan.configuration.global.GlobalConfigurationBuilder();
    TransportConfiguration transport = this.transport.getValue();
    // This fails due to ISPN-4755 !!
    // this.builder.transport().read(this.transport.getValue());
    // Workaround this by copying relevant fields individually
    builder.transport().transport(transport.transport()).distributedSyncTimeout(transport.distributedSyncTimeout()).clusterName(transport.clusterName()).machineId(transport.machineId()).rackId(transport.rackId()).siteId(transport.siteId());
    Module module = this.module.getValue();
    builder.serialization().classResolver(ModularClassResolver.getInstance(this.loader.getValue()));
    builder.classLoader(module.getClassLoader());
    int id = Ids.MAX_ID;
    for (Externalizer<?> externalizer : module.loadService(Externalizer.class)) {
        InfinispanLogger.ROOT_LOGGER.debugf("Cache container %s will use an externalizer for %s", this.name, externalizer.getTargetClass().getName());
        builder.serialization().addAdvancedExternalizer(id++, new AdvancedExternalizerAdapter<>(externalizer));
    }
    builder.transport().transportThreadPool().read(this.pools.get(ThreadPoolResourceDefinition.TRANSPORT).getValue());
    builder.transport().remoteCommandThreadPool().read(this.pools.get(ThreadPoolResourceDefinition.REMOTE_COMMAND).getValue());
    builder.asyncThreadPool().read(this.pools.get(ThreadPoolResourceDefinition.ASYNC_OPERATIONS).getValue());
    builder.expirationThreadPool().read(this.schedulers.get(ScheduledThreadPoolResourceDefinition.EXPIRATION).getValue());
    builder.listenerThreadPool().read(this.pools.get(ThreadPoolResourceDefinition.LISTENER).getValue());
    builder.stateTransferThreadPool().read(this.pools.get(ThreadPoolResourceDefinition.STATE_TRANSFER).getValue());
    builder.persistenceThreadPool().read(this.pools.get(ThreadPoolResourceDefinition.PERSISTENCE).getValue());
    builder.shutdown().hookBehavior(ShutdownHookBehavior.DONT_REGISTER);
    builder.globalJmxStatistics().enabled(this.statisticsEnabled).cacheManagerName(this.name).mBeanServerLookup(new MBeanServerProvider((this.server != null) ? this.server.getValue() : null)).jmxDomain("org.wildfly.clustering.infinispan").allowDuplicateDomains(true);
    builder.site().read(this.site.getValue());
    return builder.build();
}
Also used : TransportConfiguration(org.infinispan.configuration.global.TransportConfiguration) Module(org.jboss.modules.Module) MBeanServerProvider(org.jboss.as.clustering.infinispan.MBeanServerProvider)

Example 2 with TransportConfiguration

use of org.infinispan.configuration.global.TransportConfiguration in project wildfly by wildfly.

the class JGroupsTransportBuilder method getValue.

@Override
public TransportConfiguration getValue() {
    ChannelFactory factory = this.factory.getValue();
    ProtocolStackConfiguration stack = factory.getProtocolStackConfiguration();
    org.wildfly.clustering.jgroups.spi.TransportConfiguration.Topology topology = stack.getTransport().getTopology();
    TransportConfigurationBuilder builder = new GlobalConfigurationBuilder().transport().clusterName(this.containerName).distributedSyncTimeout(this.lockTimeout).transport(new ChannelFactoryTransport(factory));
    if (topology != null) {
        builder.siteId(topology.getSite()).rackId(topology.getRack()).machineId(topology.getMachine());
    }
    return builder.create();
}
Also used : GlobalConfigurationBuilder(org.infinispan.configuration.global.GlobalConfigurationBuilder) TransportConfigurationBuilder(org.infinispan.configuration.global.TransportConfigurationBuilder) ProtocolStackConfiguration(org.wildfly.clustering.jgroups.spi.ProtocolStackConfiguration) TransportConfiguration(org.infinispan.configuration.global.TransportConfiguration) ChannelFactory(org.wildfly.clustering.jgroups.spi.ChannelFactory) ChannelFactoryTransport(org.jboss.as.clustering.infinispan.ChannelFactoryTransport)

Example 3 with TransportConfiguration

use of org.infinispan.configuration.global.TransportConfiguration in project wildfly by wildfly.

the class ChannelFactoryTransport method setConfiguration.

@Inject
@Override
public void setConfiguration(GlobalConfiguration config) {
    GlobalConfigurationBuilder builder = new GlobalConfigurationBuilder();
    // WFLY-6685 Prevent Infinispan from registering channel mbeans
    // The JGroups subsystem already does this
    builder.globalJmxStatistics().read(config.globalJmxStatistics()).disable();
    // ISPN-4755 workaround
    TransportConfiguration transport = config.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());
    super.setConfiguration(builder.build());
}
Also used : GlobalConfigurationBuilder(org.infinispan.configuration.global.GlobalConfigurationBuilder) TransportConfiguration(org.infinispan.configuration.global.TransportConfiguration) Inject(org.infinispan.factories.annotations.Inject)

Aggregations

TransportConfiguration (org.infinispan.configuration.global.TransportConfiguration)3 GlobalConfigurationBuilder (org.infinispan.configuration.global.GlobalConfigurationBuilder)2 TransportConfigurationBuilder (org.infinispan.configuration.global.TransportConfigurationBuilder)1 Inject (org.infinispan.factories.annotations.Inject)1 ChannelFactoryTransport (org.jboss.as.clustering.infinispan.ChannelFactoryTransport)1 MBeanServerProvider (org.jboss.as.clustering.infinispan.MBeanServerProvider)1 Module (org.jboss.modules.Module)1 ChannelFactory (org.wildfly.clustering.jgroups.spi.ChannelFactory)1 ProtocolStackConfiguration (org.wildfly.clustering.jgroups.spi.ProtocolStackConfiguration)1