use of org.infinispan.configuration.cache.ConfigurationBuilder in project hibernate-orm by hibernate.
the class InfinispanRegionFactory method defineDataTypeCacheConfigurations.
private void defineDataTypeCacheConfigurations() {
for (DataType type : DataType.values()) {
String cacheName = baseConfigurations.get(type.key);
if (cacheName == null) {
cacheName = type.defaultCacheName;
}
Configuration configuration = manager.getCacheConfiguration(cacheName);
ConfigurationBuilder builder;
if (configuration == null) {
log.debugf("Cache configuration not found for %s", type);
if (!cacheName.equals(type.defaultCacheName)) {
log.customConfigForTypeNotFound(cacheName, type.key);
}
builder = defaultConfiguration.getNamedConfigurationBuilders().get(type.defaultCacheName);
if (builder == null) {
throw new IllegalStateException("Generic data types must have default configuration, none found for " + type);
}
} else {
builder = new ConfigurationBuilder().read(configuration);
}
ConfigurationBuilder override = configOverrides.get(type.key);
if (override != null) {
builder.read(override.build(false));
}
builder.template(true);
configureTransactionManager(builder);
dataTypeConfigurations.put(type, builder.build());
}
}
use of org.infinispan.configuration.cache.ConfigurationBuilder in project wildfly by wildfly.
the class ClusteredCacheBuilder method configure.
@Override
public Builder<Configuration> configure(OperationContext context, ModelNode model) throws OperationFailedException {
Mode mode = ModelNodes.asEnum(MODE.resolveModelAttribute(context, model), Mode.class);
ClusteringConfigurationBuilder builder = new ConfigurationBuilder().clustering().cacheMode(mode.apply(this.mode));
if (mode.isSynchronous()) {
builder.sync().replTimeout(REMOTE_TIMEOUT.resolveModelAttribute(context, model).asLong());
} else {
builder.async();
}
this.clustering = builder.create();
return super.configure(context, model);
}
use of org.infinispan.configuration.cache.ConfigurationBuilder in project wildfly by wildfly.
the class DistributedCacheBuilder method configure.
@Override
public Builder<Configuration> configure(OperationContext context, ModelNode model) throws OperationFailedException {
this.consistentHashStrategy = ModelNodes.asEnum(CONSISTENT_HASH_STRATEGY.resolveModelAttribute(context, model), ConsistentHashStrategy.class);
ClusteringConfigurationBuilder builder = new ConfigurationBuilder().clustering();
this.hash = builder.hash().capacityFactor(CAPACITY_FACTOR.resolveModelAttribute(context, model).asInt()).numOwners(OWNERS.resolveModelAttribute(context, model).asInt()).numSegments(SEGMENTS.resolveModelAttribute(context, model).asInt()).create();
long l1Lifespan = L1_LIFESPAN.resolveModelAttribute(context, model).asLong();
this.l1 = builder.l1().enabled(l1Lifespan > 0).lifespan(l1Lifespan).create();
this.global = new InjectedValueDependency<>(InfinispanRequirement.CONFIGURATION.getServiceName(context, this.containerName), GlobalConfiguration.class);
return super.configure(context, model);
}
use of org.infinispan.configuration.cache.ConfigurationBuilder in project wildfly by wildfly.
the class BackupsBuilder method getValue.
@Override
public SitesConfiguration getValue() {
SitesConfigurationBuilder builder = new ConfigurationBuilder().sites();
builder.backupFor().read(this.backupFor.getValue());
builder.disableBackups(this.backups.isEmpty());
for (Map.Entry<String, BackupConfiguration> backup : this.backups.entrySet()) {
builder.addBackup().read(backup.getValue());
builder.addInUseBackupSite(backup.getKey());
}
return builder.create();
}
use of org.infinispan.configuration.cache.ConfigurationBuilder in project OpenOLAT by OpenOLAT.
the class InfinispanCacher method createInfinispanConfiguration.
private void createInfinispanConfiguration(String cacheName) {
Configuration conf = cacheManager.getCacheConfiguration(cacheName);
if (conf == null) {
long maxEntries = 10000;
long maxIdle = 900000l;
ConfigurationBuilder builder = new ConfigurationBuilder();
builder.eviction().strategy(EvictionStrategy.LRU);
builder.eviction().type(EvictionType.COUNT).size(maxEntries);
builder.expiration().maxIdle(maxIdle);
builder.transaction().transactionMode(TransactionMode.NON_TRANSACTIONAL);
builder.dataContainer().storeAsBinary().storeValuesAsBinary(false);
builder.locking().concurrencyLevel(1000);
builder.locking().useLockStriping(false);
builder.locking().lockAcquisitionTimeout(15000);
builder.locking().isolationLevel(IsolationLevel.READ_COMMITTED);
builder.jmxStatistics().enable();
Configuration configurationOverride = builder.build();
cacheManager.defineConfiguration(cacheName, configurationOverride);
}
}
Aggregations