Search in sources :

Example 1 with Grouper

use of org.infinispan.distribution.group.Grouper in project wildfly by wildfly.

the class CacheConfigurationBuilder method configure.

@Override
public Builder<Configuration> configure(OperationContext context, ModelNode model) throws OperationFailedException {
    boolean enabled = STATISTICS_ENABLED.resolveModelAttribute(context, model).asBoolean();
    this.statistics = new ConfigurationBuilder().jmxStatistics().enabled(enabled).available(enabled).create();
    this.global = new InjectedValueDependency<>(InfinispanRequirement.CONFIGURATION.getServiceName(context, this.containerName), GlobalConfiguration.class);
    this.builder = new org.wildfly.clustering.infinispan.spi.service.ConfigurationBuilder(CONFIGURATION.getServiceName(context.getCurrentAddress()), this.containerName, this.cacheName, this.andThen(builder -> {
        CacheMode mode = builder.clustering().cacheMode();
        if (mode.isSynchronous() && (this.transaction.getValue().lockingMode() == LockingMode.OPTIMISTIC) && (this.locking.getValue().isolationLevel() == IsolationLevel.REPEATABLE_READ)) {
            builder.locking().writeSkewCheck(true);
            builder.versioning().enable().scheme(VersioningScheme.SIMPLE);
        }
        GroupsConfigurationBuilder groupsBuilder = builder.clustering().hash().groups().enabled();
        this.module.getValue().loadService(Grouper.class).forEach(grouper -> groupsBuilder.addGrouper(grouper));
    })).configure(context);
    return this;
}
Also used : ValueDependency(org.wildfly.clustering.service.ValueDependency) ConfigurationBuilder(org.infinispan.configuration.cache.ConfigurationBuilder) ExpirationConfiguration(org.infinispan.configuration.cache.ExpirationConfiguration) PersistenceConfiguration(org.infinispan.configuration.cache.PersistenceConfiguration) GlobalConfiguration(org.infinispan.configuration.global.GlobalConfiguration) OperationContext(org.jboss.as.controller.OperationContext) EvictionConfiguration(org.infinispan.configuration.cache.EvictionConfiguration) GroupsConfigurationBuilder(org.infinispan.configuration.cache.GroupsConfigurationBuilder) InfinispanRequirement(org.wildfly.clustering.infinispan.spi.InfinispanRequirement) Capability(org.jboss.as.clustering.infinispan.subsystem.CacheResourceDefinition.Capability) InjectedValueDependency(org.wildfly.clustering.service.InjectedValueDependency) ServiceTarget(org.jboss.msc.service.ServiceTarget) VersioningScheme(org.infinispan.configuration.cache.VersioningScheme) PathAddress(org.jboss.as.controller.PathAddress) Attribute(org.jboss.as.clustering.infinispan.subsystem.CacheResourceDefinition.Attribute) ServiceBuilder(org.jboss.msc.service.ServiceBuilder) LockingMode(org.infinispan.transaction.LockingMode) ResourceServiceBuilder(org.jboss.as.clustering.controller.ResourceServiceBuilder) TransactionConfiguration(org.infinispan.configuration.cache.TransactionConfiguration) Consumer(java.util.function.Consumer) ServiceController(org.jboss.msc.service.ServiceController) CacheMode(org.infinispan.configuration.cache.CacheMode) Grouper(org.infinispan.distribution.group.Grouper) IsolationLevel(org.infinispan.util.concurrent.IsolationLevel) Module(org.jboss.modules.Module) OperationFailedException(org.jboss.as.controller.OperationFailedException) Configuration(org.infinispan.configuration.cache.Configuration) ServiceName(org.jboss.msc.service.ServiceName) ModelNode(org.jboss.dmr.ModelNode) LockingConfiguration(org.infinispan.configuration.cache.LockingConfiguration) JMXStatisticsConfiguration(org.infinispan.configuration.cache.JMXStatisticsConfiguration) Builder(org.wildfly.clustering.service.Builder) InjectedValue(org.jboss.msc.value.InjectedValue) ConfigurationBuilder(org.infinispan.configuration.cache.ConfigurationBuilder) GroupsConfigurationBuilder(org.infinispan.configuration.cache.GroupsConfigurationBuilder) GlobalConfiguration(org.infinispan.configuration.global.GlobalConfiguration) GroupsConfigurationBuilder(org.infinispan.configuration.cache.GroupsConfigurationBuilder) CacheMode(org.infinispan.configuration.cache.CacheMode)

Aggregations

Consumer (java.util.function.Consumer)1 CacheMode (org.infinispan.configuration.cache.CacheMode)1 Configuration (org.infinispan.configuration.cache.Configuration)1 ConfigurationBuilder (org.infinispan.configuration.cache.ConfigurationBuilder)1 EvictionConfiguration (org.infinispan.configuration.cache.EvictionConfiguration)1 ExpirationConfiguration (org.infinispan.configuration.cache.ExpirationConfiguration)1 GroupsConfigurationBuilder (org.infinispan.configuration.cache.GroupsConfigurationBuilder)1 JMXStatisticsConfiguration (org.infinispan.configuration.cache.JMXStatisticsConfiguration)1 LockingConfiguration (org.infinispan.configuration.cache.LockingConfiguration)1 PersistenceConfiguration (org.infinispan.configuration.cache.PersistenceConfiguration)1 TransactionConfiguration (org.infinispan.configuration.cache.TransactionConfiguration)1 VersioningScheme (org.infinispan.configuration.cache.VersioningScheme)1 GlobalConfiguration (org.infinispan.configuration.global.GlobalConfiguration)1 Grouper (org.infinispan.distribution.group.Grouper)1 LockingMode (org.infinispan.transaction.LockingMode)1 IsolationLevel (org.infinispan.util.concurrent.IsolationLevel)1 ResourceServiceBuilder (org.jboss.as.clustering.controller.ResourceServiceBuilder)1 Attribute (org.jboss.as.clustering.infinispan.subsystem.CacheResourceDefinition.Attribute)1 Capability (org.jboss.as.clustering.infinispan.subsystem.CacheResourceDefinition.Capability)1 OperationContext (org.jboss.as.controller.OperationContext)1