Search in sources :

Example 1 with ControlledConsistentHashFactory

use of org.infinispan.util.ControlledConsistentHashFactory in project infinispan by infinispan.

the class CommitTimeoutTest method createCacheManagers.

@Override
protected void createCacheManagers() throws Throwable {
    ControlledConsistentHashFactory consistentHashFactory = new ControlledConsistentHashFactory.Default(1, 2);
    ConfigurationBuilder builder = new ConfigurationBuilder();
    builder.clustering().cacheMode(CacheMode.DIST_SYNC);
    builder.clustering().remoteTimeout(2000);
    builder.clustering().hash().numSegments(1).consistentHashFactory(consistentHashFactory);
    builder.transaction().transactionMode(TransactionMode.TRANSACTIONAL);
    addClusterEnabledCacheManager(builder);
    addClusterEnabledCacheManager(builder);
    addClusterEnabledCacheManager(builder);
    waitForClusterToForm();
}
Also used : ConfigurationBuilder(org.infinispan.configuration.cache.ConfigurationBuilder) ControlledConsistentHashFactory(org.infinispan.util.ControlledConsistentHashFactory)

Example 2 with ControlledConsistentHashFactory

use of org.infinispan.util.ControlledConsistentHashFactory in project infinispan by infinispan.

the class OriginatorBecomesOwnerLockTest method createCacheManagers.

@Override
protected void createCacheManagers() throws Throwable {
    configurationBuilder = getDefaultClusteredCacheConfig(CacheMode.DIST_SYNC, true, true);
    configurationBuilder.transaction().transactionManagerLookup(new EmbeddedTransactionManagerLookup());
    configurationBuilder.clustering().remoteTimeout(30000, TimeUnit.MILLISECONDS);
    configurationBuilder.clustering().hash().l1().disable();
    configurationBuilder.locking().lockAcquisitionTimeout(TestingUtil.shortTimeoutMillis());
    configurationBuilder.clustering().stateTransfer().fetchInMemoryState(true);
    ControlledConsistentHashFactory consistentHashFactory = new ControlledConsistentHashFactory.Default(new int[][] { { KILLED_INDEX, ORIGINATOR_INDEX }, { KILLED_INDEX, OTHER_INDEX } });
    configurationBuilder.clustering().hash().numSegments(2).consistentHashFactory(consistentHashFactory);
    createCluster(TestDataSCI.INSTANCE, configurationBuilder, 3);
    waitForClusterToForm();
    originatorCache = cache(ORIGINATOR_INDEX);
    killedCache = cache(KILLED_INDEX);
    otherCache = cache(OTHER_INDEX);
    // Set up the consistent hash after node 1 is killed
    consistentHashFactory.setOwnerIndexes(new int[][] { { ORIGINATOR_INDEX, OTHER_INDEX }, { OTHER_INDEX, ORIGINATOR_INDEX } });
// TODO Add another test method with ownership changing from [KILLED_INDEX, OTHER_INDEX] to [ORIGINATOR_INDEX, OTHER_INDEX]
// i.e. the originator is a non-owner at first, and becomes the primary owner when the prepare is retried
}
Also used : EmbeddedTransactionManagerLookup(org.infinispan.transaction.lookup.EmbeddedTransactionManagerLookup) ControlledConsistentHashFactory(org.infinispan.util.ControlledConsistentHashFactory)

Example 3 with ControlledConsistentHashFactory

use of org.infinispan.util.ControlledConsistentHashFactory in project infinispan by infinispan.

the class WriteSkewConsistencyTest method createCacheManagers.

@Override
protected final void createCacheManagers() {
    ConfigurationBuilder builder = getDefaultClusteredCacheConfig(cacheMode, true);
    builder.locking().isolationLevel(IsolationLevel.REPEATABLE_READ);
    ControlledConsistentHashFactory consistentHashFactory = cacheMode.isReplicated() ? new ControlledConsistentHashFactory.Replicated(1) : new ControlledConsistentHashFactory.Default(1, 0);
    builder.clustering().hash().numSegments(1).consistentHashFactory(consistentHashFactory);
    createClusteredCaches(4, TestDataSCI.INSTANCE, builder);
}
Also used : ConfigurationBuilder(org.infinispan.configuration.cache.ConfigurationBuilder) ControlledConsistentHashFactory(org.infinispan.util.ControlledConsistentHashFactory)

Example 4 with ControlledConsistentHashFactory

use of org.infinispan.util.ControlledConsistentHashFactory in project infinispan by infinispan.

the class ExpirationWithClusteredWriteSkewTest method createCacheManagers.

@Override
protected void createCacheManagers() throws Throwable {
    ControlledConsistentHashFactory chf = new ControlledConsistentHashFactory.Default(0, 1);
    ConfigurationBuilder builder = TestCacheManagerFactory.getDefaultCacheConfiguration(true);
    builder.clustering().cacheMode(CacheMode.REPL_SYNC).hash().numSegments(1).consistentHashFactory(chf).expiration().lifespan(10, TimeUnit.SECONDS).transaction().transactionMode(TransactionMode.TRANSACTIONAL).lockingMode(LockingMode.OPTIMISTIC).locking().isolationLevel(IsolationLevel.REPEATABLE_READ);
    createCluster(builder, 2);
    TestingUtil.replaceComponent(manager(0), TimeService.class, timeService, true);
    expirationManager1 = cache(0).getAdvancedCache().getExpirationManager();
    TestingUtil.replaceComponent(manager(1), TimeService.class, timeService, true);
    expirationManager2 = cache(1).getAdvancedCache().getExpirationManager();
}
Also used : ConfigurationBuilder(org.infinispan.configuration.cache.ConfigurationBuilder) ControlledConsistentHashFactory(org.infinispan.util.ControlledConsistentHashFactory)

Aggregations

ControlledConsistentHashFactory (org.infinispan.util.ControlledConsistentHashFactory)4 ConfigurationBuilder (org.infinispan.configuration.cache.ConfigurationBuilder)3 EmbeddedTransactionManagerLookup (org.infinispan.transaction.lookup.EmbeddedTransactionManagerLookup)1