use of org.infinispan.configuration.cache.ConfigurationBuilder in project wildfly by wildfly.
the class DefaultCacheContainerTestCase method getCacheConfiguration.
@Test
public void getCacheConfiguration() {
Configuration config = new ConfigurationBuilder().build();
when(this.manager.getCacheConfiguration("cache")).thenReturn(config);
Configuration result = this.subject.getCacheConfiguration("cache");
assertSame(config, result);
}
use of org.infinispan.configuration.cache.ConfigurationBuilder in project wildfly by wildfly.
the class ConfigurationServiceConfigurator method get.
@Override
public Configuration get() {
ConfigurationBuilder builder = new ConfigurationBuilder();
this.consumer.accept(builder);
// Auto-enable simple cache optimization if cache is local, on-heap, non-transactional, and non-persistent, and statistics are disabled
builder.simpleCache((builder.clustering().cacheMode() == CacheMode.LOCAL) && (builder.memory().storage() == StorageType.HEAP) && !builder.transaction().transactionMode().isTransactional() && builder.persistence().stores().isEmpty() && !builder.statistics().create().enabled());
builder.encoding().mediaType(builder.memory().storage() == StorageType.OFF_HEAP ? this.container.get().getCacheManagerConfiguration().serialization().marshaller().mediaType().toString() : MediaType.APPLICATION_OBJECT_TYPE);
Configuration configuration = builder.build();
EmbeddedCacheManager container = this.container.get();
container.defineConfiguration(this.cacheName, configuration);
return configuration;
}
use of org.infinispan.configuration.cache.ConfigurationBuilder in project wildfly by wildfly.
the class StoreServiceConfigurator method get.
@Override
public PersistenceConfiguration get() {
B builder = new ConfigurationBuilder().persistence().passivation(this.passivation).addStore(this.builderClass).fetchPersistentState(this.fetchState).maxBatchSize(this.maxBatchSize).preload(this.preload).purgeOnStartup(this.purge).shared(this.shared).withProperties(this.properties);
this.accept(builder);
return builder.async().read(this.async.get()).persistence().create();
}
use of org.infinispan.configuration.cache.ConfigurationBuilder in project gora by apache.
the class SimulationDriver method createCacheManagers.
@Override
public void createCacheManagers() throws Throwable {
ConfigurationBuilder builder = hotRodCacheConfiguration(getDefaultClusteredCacheConfig(CacheMode.DIST_SYNC, false));
create(numberOfNodes, builder);
}
use of org.infinispan.configuration.cache.ConfigurationBuilder in project gora by apache.
the class SimulationDriver method create.
// Helpers
protected void create(int nnodes, ConfigurationBuilder defaultBuilder) {
// Start Hot Rod servers at each site.
for (int j = 0; j < nnodes; j++) {
GlobalConfigurationBuilder gbuilder = GlobalConfigurationBuilder.defaultClusteredBuilder();
Transport transport = gbuilder.transport().getTransport();
gbuilder.transport().transport(transport);
gbuilder.transport().clusterName("test");
startHotRodServer(gbuilder, defaultBuilder, j + 1);
}
// Create appropriate caches at each node.
ConfigurationBuilder builder = hotRodCacheConfiguration(getDefaultClusteredCacheConfig(CacheMode.DIST_SYNC, false));
builder.indexing().index(Index.LOCAL).addProperty("default.directory_provider", "ram").addProperty("hibernate.search.default.exclusive_index_use", "true").addProperty("hibernate.search.default.indexmanager", "near-real-time").addProperty("hibernate.search.default.indexwriter.ram_buffer_size", "128").addProperty("lucene_version", "LUCENE_CURRENT");
builder.clustering().hash().numOwners(1);
builder.jmxStatistics().enable();
builder.transaction().transactionMode(TransactionMode.TRANSACTIONAL);
Configuration configuration = builder.build();
for (int j = 0; j < nnodes; j++) {
for (String name : cacheNames) {
manager(j).defineConfiguration(name, configuration);
manager(j).getCache(name, true);
}
}
// Verify that default caches are started.
for (int j = 0; j < nnodes; j++) {
assert manager(j).getCache() != null;
}
// Verify that the default caches is running.
for (int j = 0; j < nnodes; j++) {
blockUntilCacheStatusAchieved(manager(j).getCache(), ComponentStatus.RUNNING, 10000);
}
for (int j = 0; j < nnodes; j++) {
if (j != 0)
connectionString += ";";
connectionString += server(j).getHost() + ":" + server(j).getPort();
}
}
Aggregations