use of org.infinispan.configuration.cache.Configuration in project wildfly by wildfly.
the class InfinispanCachePropertiesTestCase method isMarshalling.
@Test
public void isMarshalling() {
for (CacheMode mode : EnumSet.allOf(CacheMode.class)) {
Configuration config = new ConfigurationBuilder().clustering().cacheMode(mode).build();
CacheProperties configuration = new InfinispanCacheProperties(config);
if (mode.isDistributed() || mode.isReplicated() || mode.isScattered()) {
Assert.assertTrue(mode.name(), configuration.isMarshalling());
} else {
Assert.assertFalse(mode.name(), configuration.isMarshalling());
}
}
Configuration config = new ConfigurationBuilder().clustering().cacheMode(CacheMode.LOCAL).persistence().passivation(false).addSingleFileStore().build();
Assert.assertTrue(new InfinispanCacheProperties(config).isMarshalling());
Configuration passivating = new ConfigurationBuilder().read(config).persistence().passivation(true).build();
Assert.assertTrue(new InfinispanCacheProperties(passivating).isMarshalling());
Configuration noStore = new ConfigurationBuilder().read(config).persistence().clearStores().build();
Assert.assertFalse(new InfinispanCacheProperties(noStore).isMarshalling());
}
use of org.infinispan.configuration.cache.Configuration in project wildfly by wildfly.
the class InfinispanCachePropertiesTestCase method isLockOnWrite.
@Test
public void isLockOnWrite() {
Configuration config = new ConfigurationBuilder().transaction().transactionMode(TransactionMode.TRANSACTIONAL).lockingMode(LockingMode.PESSIMISTIC).build();
Assert.assertTrue(new InfinispanCacheProperties(config).isLockOnWrite());
Configuration optimistic = config = new ConfigurationBuilder().read(config).transaction().lockingMode(LockingMode.OPTIMISTIC).build();
Assert.assertFalse(new InfinispanCacheProperties(optimistic).isLockOnWrite());
Configuration nonTx = new ConfigurationBuilder().read(config).transaction().transactionMode(TransactionMode.NON_TRANSACTIONAL).build();
Assert.assertFalse(new InfinispanCacheProperties(nonTx).isLockOnWrite());
}
use of org.infinispan.configuration.cache.Configuration in project wildfly by wildfly.
the class InfinispanCachePropertiesTestCase method isPersistent.
@Test
public void isPersistent() {
for (CacheMode mode : EnumSet.allOf(CacheMode.class)) {
Configuration config = new ConfigurationBuilder().clustering().cacheMode(mode).build();
CacheProperties configuration = new InfinispanCacheProperties(config);
if (mode.isDistributed() || mode.isReplicated() || mode.isScattered()) {
Assert.assertTrue(mode.name(), configuration.isPersistent());
} else {
Assert.assertFalse(mode.name(), configuration.isPersistent());
}
}
Configuration config = new ConfigurationBuilder().clustering().cacheMode(CacheMode.LOCAL).persistence().passivation(false).addSingleFileStore().build();
Assert.assertTrue(new InfinispanCacheProperties(config).isPersistent());
Configuration passivating = new ConfigurationBuilder().read(config).persistence().passivation(true).build();
Assert.assertFalse(new InfinispanCacheProperties(passivating).isPersistent());
Configuration noStore = new ConfigurationBuilder().read(config).persistence().clearStores().build();
Assert.assertFalse(new InfinispanCacheProperties(noStore).isPersistent());
}
use of org.infinispan.configuration.cache.Configuration 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();
}
}
use of org.infinispan.configuration.cache.Configuration in project hibernate-orm by hibernate.
the class BaseTransactionalDataRegion method prepareForTombstones.
private void prepareForTombstones() {
if (strategy != null) {
assert strategy == Strategy.TOMBSTONES;
return;
}
Configuration configuration = cache.getCacheConfiguration();
if (configuration.eviction().maxEntries() >= 0) {
log.evictionWithTombstones();
}
replaceCommonInterceptors();
replaceExpirationManager();
cache.removeInterceptor(CallInterceptor.class);
TombstoneCallInterceptor tombstoneCallInterceptor = new TombstoneCallInterceptor(this);
cache.getComponentRegistry().registerComponent(tombstoneCallInterceptor, TombstoneCallInterceptor.class);
List<CommandInterceptor> interceptorChain = cache.getInterceptorChain();
cache.addInterceptor(tombstoneCallInterceptor, interceptorChain.size());
strategy = Strategy.TOMBSTONES;
}
Aggregations