@Override public void accept(ConfigurationBuilder builder) { super.accept(builder); HashConfigurationBuilder hash = builder.clustering().hash().numSegments(this.segments); // ConsistentHashStrategy.INTER_CACHE is Infinispan's default behavior if (this.consistentHashStrategy == ConsistentHashStrategy.INTRA_CACHE) { hash.consistentHashFactory(this.global.get().transport().hasTopologyInfo() ? new TopologyAwareConsistentHashFactory() : new DefaultConsistentHashFactory()); } } }
private ConfigurationBuilder configuration() { ConfigurationBuilder builder = getDefaultClusteredCacheConfig(CacheMode.REPL_SYNC, true); builder.clustering() .stateTransfer().fetchInMemoryState(true) .hash().numSegments(1).numOwners(3).consistentHashFactory(new ConsistentHashFactoryImpl()); builder.locking().isolationLevel(IsolationLevel.REPEATABLE_READ); return builder; }
@Override protected void createCacheManagers() throws Throwable { dccc = getDefaultClusteredCacheConfig(CacheMode.DIST_SYNC, true, true); dccc.transaction() .transactionManagerLookup(new EmbeddedTransactionManagerLookup()) .lockingMode(LockingMode.PESSIMISTIC) .locking().lockAcquisitionTimeout(TestingUtil.shortTimeoutMillis()) .clustering().hash().numOwners(1).numSegments(3) .l1().disable() .stateTransfer().fetchInMemoryState(true); createCluster(dccc, 2); waitForClusterToForm(); }
@Override protected ConfigurationBuilder cacheConfiguration() { ConfigurationBuilder builder = new ConfigurationBuilder(); builder.clustering().hash().numSegments(16); return builder; }
.clustering() .cacheMode(CacheMode.DIST_ASYNC) .async() .hash() .numOwners(2) .numSegments(40) .consistentHashFactory(new SyncConsistentHashFactory()) .stateTransfer()
@Override protected ConfigurationBuilder buildConfiguration() { ConfigurationBuilder builder = super.buildConfiguration(); builder.clustering().hash(). consistentHashFactory(factory). numSegments(1); return builder; }
.clustering() .cacheMode(CacheMode.DIST_ASYNC) .async() .hash() .numOwners(2) .numSegments(40) .consistentHashFactory(new SyncConsistentHashFactory()) .stateTransfer()
@Override protected void createCacheManagers() throws Throwable { ConfigurationBuilder builder = getDefaultClusteredCacheConfig(CacheMode.REPL_SYNC, false); builder.clustering().hash().numSegments(60); createClusteredCaches(2, builder); }
private ConfigurationBuilder configuration() { ConfigurationBuilder cb = getDefaultClusteredCacheConfig(CacheMode.DIST_SYNC); cb.clustering().hash().numSegments(1).consistentHashFactory(factory); return cb; }
@Override public void accept(ConfigurationBuilder builder) { super.accept(builder); HashConfigurationBuilder hash = builder.clustering().hash().numSegments(this.segments); // ConsistentHashStrategy.INTER_CACHE is Infinispan's default behavior if (this.consistentHashStrategy == ConsistentHashStrategy.INTRA_CACHE) { hash.consistentHashFactory(this.global.get().transport().hasTopologyInfo() ? new TopologyAwareConsistentHashFactory() : new DefaultConsistentHashFactory()); } } }
public void testNumSegments() { ConfigurationBuilder cb = new ConfigurationBuilder(); cb.clustering().cacheMode(CacheMode.DIST_SYNC); cb.clustering().hash().numSegments(5); Configuration c = cb.build(); Assert.assertEquals(5, c.clustering().hash().numSegments()); try { cb.clustering().hash().numSegments(0); Assert.fail("IllegalArgumentException expected"); } catch (IllegalArgumentException e) { } }
@Test(expectedExceptions = IllegalArgumentException.class) public void numVirtualNodes() { ConfigurationBuilder cb = new ConfigurationBuilder(); cb.clustering().cacheMode(CacheMode.DIST_SYNC); cb.clustering().hash().numSegments(5); Configuration c = cb.build(); Assert.assertEquals(5, c.clustering().hash().numSegments()); // negative test cb.clustering().hash().numSegments(0); }
@Override protected void createCacheManagers() throws Throwable { ConfigurationBuilder builder = getDefaultClusteredCacheConfig(cacheMode, false); if (biasAcquisition != null) { builder.clustering().biasAcquisition(biasAcquisition); } builder.clustering().hash().numSegments(60); createClusteredCaches(2, builder); }
private ConfigurationBuilder buildConfig() { // The coordinator will always be the primary owner ConfigurationBuilder configurationBuilder = getDefaultClusteredCacheConfig(CacheMode.REPL_SYNC, true); configurationBuilder.clustering().hash().numSegments(60); configurationBuilder.transaction().lockingMode(LockingMode.PESSIMISTIC); return configurationBuilder; }
@Override protected ConfigurationBuilder buildConfiguration() { ConfigurationBuilder builder = super.buildConfiguration(); ControlledConsistentHashFactory.Default chf = new ControlledConsistentHashFactory.Default( new int[][]{{0, 1}, {1, 2}}); builder.clustering().hash().numOwners(2).numSegments(2).consistentHashFactory(chf); return builder; }
private ConfigurationBuilder getConfigurationBuilder() { final ConfigurationBuilder conf = getDefaultClusteredCacheConfig(DIST_SYNC, false); conf.clustering().hash().keyPartitioner(new AffinityPartitioner()).numSegments(10).numOwners(1); return conf; }
@Override protected final void createCacheManagers() throws Throwable { ConfigurationBuilder builder = getDefaultClusteredCacheConfig(cacheMode, true); builder.locking().isolationLevel(IsolationLevel.REPEATABLE_READ); builder.clustering().hash().numSegments(60); createClusteredCaches(4, builder); }
@Override protected void createCacheManagers() throws Throwable { builderUsed = new ConfigurationBuilder(); builderUsed.clustering().cacheMode(cacheMode).hash().consistentHashFactory(factory).numSegments(1); createClusteredCaches(3, CACHE_NAME, builderUsed); }
@Override protected void createCacheManagers() throws Throwable { ConfigurationBuilder replSync = getDefaultClusteredCacheConfig(CacheMode.REPL_SYNC, false); replSync.clustering().hash().numSegments(1).consistentHashFactory(new ReplicatedControlledConsistentHashFactory(0)); createClusteredCaches(2, "replSync", replSync); }
@Override protected void createCacheManagers() { ConfigurationBuilder c = getDefaultClusteredCacheConfig(CacheMode.DIST_SYNC, transactional); c.clustering().hash().numSegments(10).numOwners(1); c.clustering().l1().disable(); if (totalOrder != null && totalOrder.booleanValue()) { c.transaction().transactionProtocol(TransactionProtocol.TOTAL_ORDER); } amendConfiguration.accept(c); createClusteredCaches(2, c); }