Search in sources :

Example 1 with StateTransferConfigurationBuilder

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

the class InfinispanLegacyRoutingProviderFactory method accept.

@Override
public void accept(ConfigurationBuilder builder) {
    ClusteringConfigurationBuilder clustering = builder.clustering();
    CacheMode mode = clustering.cacheMode();
    clustering.cacheMode(mode.needsStateTransfer() ? CacheMode.REPL_SYNC : CacheMode.LOCAL);
    clustering.l1().disable();
    // Workaround for ISPN-8722
    AttributeSet attributes = ConfigurationBuilderAttributesAccessor.INSTANCE.apply(clustering);
    attributes.attribute(ClusteringConfiguration.BIAS_ACQUISITION).reset();
    attributes.attribute(ClusteringConfiguration.BIAS_LIFESPAN).reset();
    attributes.attribute(ClusteringConfiguration.INVALIDATION_BATCH_SIZE).reset();
    // Ensure we use the default data container
    builder.addModule(DataContainerConfigurationBuilder.class).evictable(null);
    // Disable expiration
    builder.expiration().lifespan(-1).maxIdle(-1);
    // Disable eviction
    builder.memory().storage(StorageType.HEAP).maxCount(-1).whenFull(EvictionStrategy.NONE);
    builder.persistence().clearStores();
    StateTransferConfigurationBuilder stateTransfer = clustering.stateTransfer().fetchInMemoryState(mode.needsStateTransfer());
    attributes = ConfigurationBuilderAttributesAccessor.INSTANCE.apply(stateTransfer);
    attributes.attribute(StateTransferConfiguration.AWAIT_INITIAL_TRANSFER).reset();
    attributes.attribute(StateTransferConfiguration.TIMEOUT).reset();
}
Also used : DataContainerConfigurationBuilder(org.wildfly.clustering.infinispan.spi.DataContainerConfigurationBuilder) ClusteringConfigurationBuilder(org.infinispan.configuration.cache.ClusteringConfigurationBuilder) AttributeSet(org.infinispan.commons.configuration.attributes.AttributeSet) CacheMode(org.infinispan.configuration.cache.CacheMode) StateTransferConfigurationBuilder(org.infinispan.configuration.cache.StateTransferConfigurationBuilder)

Example 2 with StateTransferConfigurationBuilder

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

the class InfinispanClientMappingsRegistryProvider method accept.

@Override
public void accept(ConfigurationBuilder builder) {
    ClusteringConfigurationBuilder clustering = builder.clustering();
    CacheMode mode = clustering.cacheMode();
    clustering.cacheMode(mode.needsStateTransfer() ? CacheMode.REPL_SYNC : CacheMode.LOCAL);
    clustering.l1().disable();
    // Workaround for ISPN-8722
    AttributeSet attributes = ConfigurationBuilderAttributesAccessor.INSTANCE.apply(clustering);
    attributes.attribute(ClusteringConfiguration.BIAS_ACQUISITION).reset();
    attributes.attribute(ClusteringConfiguration.BIAS_LIFESPAN).reset();
    attributes.attribute(ClusteringConfiguration.INVALIDATION_BATCH_SIZE).reset();
    // Ensure we use the default data container
    builder.addModule(DataContainerConfigurationBuilder.class).evictable(null);
    // Disable expiration
    builder.expiration().lifespan(-1).maxIdle(-1);
    // Disable eviction
    builder.memory().storage(StorageType.HEAP).maxCount(-1).whenFull(EvictionStrategy.NONE);
    builder.persistence().clearStores();
    StateTransferConfigurationBuilder stateTransfer = clustering.stateTransfer().fetchInMemoryState(mode.needsStateTransfer());
    attributes = ConfigurationBuilderAttributesAccessor.INSTANCE.apply(stateTransfer);
    attributes.attribute(StateTransferConfiguration.AWAIT_INITIAL_TRANSFER).reset();
    attributes.attribute(StateTransferConfiguration.TIMEOUT).reset();
}
Also used : DataContainerConfigurationBuilder(org.wildfly.clustering.infinispan.spi.DataContainerConfigurationBuilder) ClusteringConfigurationBuilder(org.infinispan.configuration.cache.ClusteringConfigurationBuilder) AttributeSet(org.infinispan.commons.configuration.attributes.AttributeSet) CacheMode(org.infinispan.configuration.cache.CacheMode) StateTransferConfigurationBuilder(org.infinispan.configuration.cache.StateTransferConfigurationBuilder)

Aggregations

AttributeSet (org.infinispan.commons.configuration.attributes.AttributeSet)2 CacheMode (org.infinispan.configuration.cache.CacheMode)2 ClusteringConfigurationBuilder (org.infinispan.configuration.cache.ClusteringConfigurationBuilder)2 StateTransferConfigurationBuilder (org.infinispan.configuration.cache.StateTransferConfigurationBuilder)2 DataContainerConfigurationBuilder (org.wildfly.clustering.infinispan.spi.DataContainerConfigurationBuilder)2