Search in sources :

Example 1 with PersistenceConfiguration

use of org.infinispan.configuration.cache.PersistenceConfiguration in project wildfly by wildfly.

the class StoreBuilder method configure.

@Override
public Builder<PersistenceConfiguration> configure(OperationContext context, ModelNode model) throws OperationFailedException {
    this.storeBuilder = this.storeBuilderFactory.apply(context, model);
    this.storeBuilder.persistence().passivation(PASSIVATION.resolveModelAttribute(context, model).asBoolean());
    Properties properties = new Properties();
    ModelNodes.optionalPropertyList(PROPERTIES.resolveModelAttribute(context, model)).ifPresent(list -> list.forEach(property -> properties.setProperty(property.getName(), property.getValue().asString())));
    this.storeBuilder.fetchPersistentState(FETCH_STATE.resolveModelAttribute(context, model).asBoolean()).preload(PRELOAD.resolveModelAttribute(context, model).asBoolean()).purgeOnStartup(PURGE.resolveModelAttribute(context, model).asBoolean()).shared(SHARED.resolveModelAttribute(context, model).asBoolean()).singleton().enabled(SINGLETON.resolveModelAttribute(context, model).asBoolean()).withProperties(properties);
    return this;
}
Also used : PROPERTIES(org.jboss.as.clustering.infinispan.subsystem.StoreResourceDefinition.Attribute.PROPERTIES) ExceptionBiFunction(org.wildfly.common.function.ExceptionBiFunction) Properties(java.util.Properties) SINGLETON(org.jboss.as.clustering.infinispan.subsystem.StoreResourceDefinition.Attribute.SINGLETON) PathAddress(org.jboss.as.controller.PathAddress) PersistenceConfiguration(org.infinispan.configuration.cache.PersistenceConfiguration) ServiceBuilder(org.jboss.msc.service.ServiceBuilder) PURGE(org.jboss.as.clustering.infinispan.subsystem.StoreResourceDefinition.Attribute.PURGE) PRELOAD(org.jboss.as.clustering.infinispan.subsystem.StoreResourceDefinition.Attribute.PRELOAD) ResourceServiceBuilder(org.jboss.as.clustering.controller.ResourceServiceBuilder) PASSIVATION(org.jboss.as.clustering.infinispan.subsystem.StoreResourceDefinition.Attribute.PASSIVATION) Consumer(java.util.function.Consumer) AbstractStoreConfigurationBuilder(org.infinispan.configuration.cache.AbstractStoreConfigurationBuilder) ModelNodes(org.jboss.as.clustering.dmr.ModelNodes) StoreConfiguration(org.infinispan.configuration.cache.StoreConfiguration) OperationContext(org.jboss.as.controller.OperationContext) OperationFailedException(org.jboss.as.controller.OperationFailedException) FETCH_STATE(org.jboss.as.clustering.infinispan.subsystem.StoreResourceDefinition.Attribute.FETCH_STATE) ModelNode(org.jboss.dmr.ModelNode) ServiceTarget(org.jboss.msc.service.ServiceTarget) SHARED(org.jboss.as.clustering.infinispan.subsystem.StoreResourceDefinition.Attribute.SHARED) AsyncStoreConfiguration(org.infinispan.configuration.cache.AsyncStoreConfiguration) Builder(org.wildfly.clustering.service.Builder) InjectedValue(org.jboss.msc.value.InjectedValue) Properties(java.util.Properties)

Example 2 with PersistenceConfiguration

use of org.infinispan.configuration.cache.PersistenceConfiguration in project wildfly by wildfly.

the class LocalCacheBuilder method accept.

@Override
public void accept(ConfigurationBuilder builder) {
    super.accept(builder);
    builder.clustering().cacheMode(CacheMode.LOCAL);
    TransactionConfiguration transaction = this.transaction.getValue();
    PersistenceConfiguration persistence = this.persistence.getValue();
    // Auto-enable simple cache optimization if cache is non-transactional and non-persistent
    builder.simpleCache(!transaction.transactionMode().isTransactional() && !persistence.usingStores());
    if (InfinispanLogger.ROOT_LOGGER.isTraceEnabled() && builder.simpleCache()) {
        InfinispanLogger.ROOT_LOGGER.tracef("Simple cache optimization for %s = %b", this.address, builder.simpleCache());
    }
}
Also used : PersistenceConfiguration(org.infinispan.configuration.cache.PersistenceConfiguration) TransactionConfiguration(org.infinispan.configuration.cache.TransactionConfiguration)

Aggregations

PersistenceConfiguration (org.infinispan.configuration.cache.PersistenceConfiguration)2 Properties (java.util.Properties)1 Consumer (java.util.function.Consumer)1 AbstractStoreConfigurationBuilder (org.infinispan.configuration.cache.AbstractStoreConfigurationBuilder)1 AsyncStoreConfiguration (org.infinispan.configuration.cache.AsyncStoreConfiguration)1 StoreConfiguration (org.infinispan.configuration.cache.StoreConfiguration)1 TransactionConfiguration (org.infinispan.configuration.cache.TransactionConfiguration)1 ResourceServiceBuilder (org.jboss.as.clustering.controller.ResourceServiceBuilder)1 ModelNodes (org.jboss.as.clustering.dmr.ModelNodes)1 FETCH_STATE (org.jboss.as.clustering.infinispan.subsystem.StoreResourceDefinition.Attribute.FETCH_STATE)1 PASSIVATION (org.jboss.as.clustering.infinispan.subsystem.StoreResourceDefinition.Attribute.PASSIVATION)1 PRELOAD (org.jboss.as.clustering.infinispan.subsystem.StoreResourceDefinition.Attribute.PRELOAD)1 PROPERTIES (org.jboss.as.clustering.infinispan.subsystem.StoreResourceDefinition.Attribute.PROPERTIES)1 PURGE (org.jboss.as.clustering.infinispan.subsystem.StoreResourceDefinition.Attribute.PURGE)1 SHARED (org.jboss.as.clustering.infinispan.subsystem.StoreResourceDefinition.Attribute.SHARED)1 SINGLETON (org.jboss.as.clustering.infinispan.subsystem.StoreResourceDefinition.Attribute.SINGLETON)1 OperationContext (org.jboss.as.controller.OperationContext)1 OperationFailedException (org.jboss.as.controller.OperationFailedException)1 PathAddress (org.jboss.as.controller.PathAddress)1 ModelNode (org.jboss.dmr.ModelNode)1