@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()); } } }
@SuppressWarnings("deprecation") @Override public void accept(ConfigurationBuilder builder) { ClusteringConfigurationBuilder clustering = builder.clustering(); CacheMode mode = clustering.cacheMode(); clustering.cacheMode(mode.needsStateTransfer() ? CacheMode.REPL_SYNC : CacheMode.LOCAL); // don't use DefaultConsistentHashFactory for REPL caches (WFLY-9276) clustering.hash().consistentHashFactory(null); clustering.l1().disable(); // Workaround for ISPN-8722 AttributeSet attributes = TemplateConfigurationServiceConfigurator.getAttributes(clustering); attributes.attribute(ClusteringConfiguration.BIAS_ACQUISITION).reset(); attributes.attribute(ClusteringConfiguration.BIAS_LIFESPAN).reset(); attributes.attribute(ClusteringConfiguration.INVALIDATION_BATCH_SIZE).reset(); // Ensure we use the default data container builder.dataContainer().dataContainer(null); // Disable expiration builder.expiration().lifespan(-1).maxIdle(-1); // Disable eviction builder.memory().size(-1).evictionStrategy(EvictionStrategy.MANUAL); builder.persistence().clearStores(); StateTransferConfigurationBuilder stateTransfer = clustering.stateTransfer().fetchInMemoryState(mode.needsStateTransfer()); attributes = TemplateConfigurationServiceConfigurator.getAttributes(stateTransfer); attributes.attribute(StateTransferConfiguration.AWAIT_INITIAL_TRANSFER).reset(); attributes.attribute(StateTransferConfiguration.TIMEOUT).reset(); } }
@SuppressWarnings("deprecation") @Override public void accept(ConfigurationBuilder builder) { ClusteringConfigurationBuilder clustering = builder.clustering(); CacheMode mode = clustering.cacheMode(); clustering.cacheMode(mode.needsStateTransfer() ? CacheMode.REPL_SYNC : CacheMode.LOCAL); // don't use DefaultConsistentHashFactory for REPL caches (WFLY-9276) clustering.hash().consistentHashFactory(null); clustering.l1().disable(); // Workaround for ISPN-8722 AttributeSet attributes = TemplateConfigurationServiceConfigurator.getAttributes(clustering); attributes.attribute(ClusteringConfiguration.BIAS_ACQUISITION).reset(); attributes.attribute(ClusteringConfiguration.BIAS_LIFESPAN).reset(); attributes.attribute(ClusteringConfiguration.INVALIDATION_BATCH_SIZE).reset(); // Ensure we use the default data container builder.dataContainer().dataContainer(null); // Disable expiration builder.expiration().lifespan(-1).maxIdle(-1); // Disable eviction builder.memory().size(-1).evictionStrategy(EvictionStrategy.MANUAL); builder.persistence().clearStores(); StateTransferConfigurationBuilder stateTransfer = clustering.stateTransfer().fetchInMemoryState(mode.needsStateTransfer()); attributes = TemplateConfigurationServiceConfigurator.getAttributes(stateTransfer); attributes.attribute(StateTransferConfiguration.AWAIT_INITIAL_TRANSFER).reset(); attributes.attribute(StateTransferConfiguration.TIMEOUT).reset(); } }
@Override protected ConfigurationBuilder buildConfiguration() { ConfigurationBuilder builder = super.buildConfiguration(); builder.clustering().hash(). consistentHashFactory(factory). numSegments(1); return builder; }
private ConfigurationBuilder configuration() { ConfigurationBuilder cb = getDefaultClusteredCacheConfig(CacheMode.DIST_SYNC); cb.clustering().hash().numSegments(1).consistentHashFactory(factory); return cb; }
@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; }
@Override protected void createCacheManagers() throws Throwable { ConfigurationBuilder cb = getDefaultClusteredCacheConfig(CacheMode.DIST_SYNC); ControlledConsistentHashFactory.Default chf = new ControlledConsistentHashFactory.Default( new int[][]{{0, 1}, {0, 2}, {2, 3}}); cb.clustering().hash().numOwners(2).numSegments(3).consistentHashFactory(chf); createClusteredCaches(5, cb); }
@Override protected void createCacheManagers() throws Throwable { ConfigurationBuilder cb = new ConfigurationBuilder(); chf = new ControlledConsistentHashFactory.Scattered(0); cb.clustering().cacheMode(CacheMode.SCATTERED_SYNC).hash().numSegments(1).consistentHashFactory(chf); createCluster(cb, 3); waitForClusterToForm(); }
private ConfigurationBuilder getConfigurationBuilder() { ConfigurationBuilder c = new ConfigurationBuilder(); c.clustering().cacheMode(CacheMode.DIST_SYNC); c.clustering().hash().numSegments(1).consistentHashFactory(new CustomConsistentHashFactory()); c.transaction().transactionMode(TransactionMode.NON_TRANSACTIONAL); return c; }
private ConfigurationBuilder getConfigurationBuilder() { ConfigurationBuilder c = new ConfigurationBuilder(); c.clustering().cacheMode(CacheMode.DIST_SYNC); c.clustering().hash().numSegments(1).consistentHashFactory(new CustomConsistentHashFactory()); c.transaction().transactionMode(TransactionMode.NON_TRANSACTIONAL); return c; }
protected final ConfigurationBuilder createConfigurationBuilder() { ConfigurationBuilder builder = getDefaultClusteredCacheConfig(CacheMode.DIST_SYNC, transactional); builder.clustering() .hash().numOwners(2).consistentHashFactory(new SingleKeyConsistentHashFactory()).numSegments(1) .l1().enabled(l1) .stateTransfer().fetchInMemoryState(true); return builder; }
@Override protected void createCacheManagers() throws Throwable { chFactory = new ControlledConsistentHashFactory.Default(new int[][]{{0, 1}, {0, 2}}); cb = new ConfigurationBuilder(); cb.clustering().cacheMode(CacheMode.DIST_SYNC).hash().consistentHashFactory(chFactory).numSegments(2); cb.transaction().transactionMode(TransactionMode.TRANSACTIONAL); createCluster(cb, 3); // make sure the caches are started in proper order for (int i = 0; i < 3; ++i) cache(i); }
@Override protected void createCacheManagers() throws Throwable { consistentHashFactory = new ControlledConsistentHashFactory.Default(new int[][]{{0, 1}, {1, 2}, {2, 3}, {3, 0}}); ConfigurationBuilder builderUsed = new ConfigurationBuilder(); builderUsed.clustering().cacheMode(cacheMode); if (cacheMode == CacheMode.DIST_SYNC) { builderUsed.clustering().clustering().hash().numOwners(2).numSegments(4).consistentHashFactory(consistentHashFactory); } createClusteredCaches(4, CACHE_NAME, builderUsed); }
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; }
public void testConsistentHashFactory() { ConfigurationBuilder cb = new ConfigurationBuilder(); cb.clustering().cacheMode(CacheMode.DIST_SYNC); Configuration c = cb.build(); Assert.assertNull(c.clustering().hash().consistentHashFactory()); SyncConsistentHashFactory consistentHashFactory = new SyncConsistentHashFactory(); cb.clustering().hash().consistentHashFactory(consistentHashFactory); c = cb.build(); Assert.assertSame(c.clustering().hash().consistentHashFactory(), consistentHashFactory); } }
protected ConfigurationBuilder getConfigurationBuilder() { consistentHashFactory = new ControlledConsistentHashFactory.Default(0, 1); ConfigurationBuilder c = new ConfigurationBuilder(); c.clustering().cacheMode(CacheMode.DIST_SYNC); c.clustering().hash().consistentHashFactory(consistentHashFactory).numSegments(1); c.transaction().transactionMode(TransactionMode.TRANSACTIONAL); c.transaction().lockingMode(LockingMode.PESSIMISTIC); return c; }
private ConfigurationBuilder createConfigurationBuilder() { ConfigurationBuilder builder = getDefaultClusteredCacheConfig(cacheMode, false); builder.clustering().stateTransfer().fetchInMemoryState(true); builder.clustering().hash().groups().enabled(true); builder.clustering().hash().numSegments(1); if (cacheMode.isScattered()) { builder.clustering().hash().consistentHashFactory(new CustomConsistentHashFactory(new BaseControlledConsistentHashFactory.ScatteredTrait(), cacheMode)); } else { builder.clustering().hash().consistentHashFactory(new CustomConsistentHashFactory(new BaseControlledConsistentHashFactory.DefaultTrait(), cacheMode)); } return builder; }
@Override protected void createCacheManagers() throws Throwable { consistentHashFactory = new ControlledConsistentHashFactory.Default(new int[][]{{1, 2, 3}, {1, 2, 3}}); ConfigurationBuilder builder = TestCacheManagerFactory.getDefaultCacheConfiguration(true); builder.clustering().cacheMode(CacheMode.DIST_SYNC).hash().numOwners(3); builder.clustering().hash().numSegments(2).consistentHashFactory(consistentHashFactory); createCluster(builder, 4); waitForClusterToForm(); }
@Override protected void createCacheManagers() throws Throwable { MyBaseControlledConsistentHashFactory chf = new MyBaseControlledConsistentHashFactory(); builder = getDefaultClusteredCacheConfig(CacheMode.DIST_SYNC, false); builder.clustering().hash().numSegments(1).numOwners(1).consistentHashFactory(chf); builder.clustering().l1().enable().lifespan(10, TimeUnit.MINUTES); createClusteredCaches(3, builder); }
private ConfigurationBuilder buildConfig(Class<?> commandToBlock) { ConfigurationBuilder configurationBuilder = getDefaultClusteredCacheConfig( CacheMode.REPL_ASYNC, false); configurationBuilder.clustering().remoteTimeout(15000); // The coordinator will always be the primary owner configurationBuilder.clustering().hash().numSegments(1).consistentHashFactory(new ReplicatedControlledConsistentHashFactory(0)); configurationBuilder.clustering().stateTransfer().fetchInMemoryState(true); // We must block after the commit was replicated, but before the entries are committed configurationBuilder.customInterceptors() .addInterceptor().after(EntryWrappingInterceptor.class).interceptor(new DelayInterceptor(commandToBlock)); return configurationBuilder; }