@Override public void accept(ConfigurationBuilder builder) { super.accept(builder); builder.clustering() .hash().capacityFactor(this.capacityFactor).numOwners(this.owners) .l1().enabled(this.l1Lifespan > 0).lifespan(this.l1Lifespan) ; } }
public static <K, V> DataContainer<K, V> createDataContainer(ConfigurationBuilder builder, long size, Predicate<K> evictable) { EntrySizeCalculator<? super K, ? super InternalCacheEntry<K, V>> calculator = (key, entry) -> evictable.test(key) ? 1 : 0; return builder.clustering().cacheMode().needsStateTransfer() ? new BoundedSegmentedDataContainer<>(builder.clustering().hash().create().numSegments(), size, calculator) : new EvictableDataContainer<>(size, calculator); } }
@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 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 void createCacheManagers() throws Throwable { c = getDefaultClusteredCacheConfig(CacheMode.DIST_SYNC, true); c .transaction() .lockingMode(LockingMode.PESSIMISTIC) .transactionManagerLookup(new EmbeddedTransactionManagerLookup()) .clustering() .hash().numOwners(3); createCluster(c, 2); waitForClusterToForm(); }
protected ConfigurationBuilder buildConfiguration() { ConfigurationBuilder builder = TestCacheManagerFactory.getDefaultCacheConfiguration(true); builder.invocationBatching().enable(); builder.transaction().lockingMode(LockingMode.OPTIMISTIC); builder.clustering().hash().groups().enabled(); return builder; }
@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 static ConfigurationBuilder createConfiguration() { ConfigurationBuilder builder = getDefaultClusteredCacheConfig(CacheMode.DIST_SYNC, false); builder.clustering().hash().numOwners(2); return builder; }
@Override protected ConfigurationBuilder cacheConfiguration() { ConfigurationBuilder builder = new ConfigurationBuilder(); builder.clustering().hash().numSegments(16); return builder; }
@Override protected void createCacheManagers() throws Throwable { final ConfigurationBuilder c = getDefaultClusteredCacheConfig(CacheMode.DIST_SYNC, true); c .transaction().lockingMode(LockingMode.PESSIMISTIC) .clustering() .hash().numOwners(1) .l1().disable(); createCluster(c, 2); waitForClusterToForm(); k1 = getKeyForCache(1); commandFactory = ControlledCommandFactory.registerControlledCommandFactory(cache(1), CommitCommand.class); }
@Override protected void createCacheManagers() throws Throwable { dccc = getDefaultClusteredCacheConfig(CacheMode.DIST_SYNC, true, true); dccc.transaction().transactionManagerLookup(new EmbeddedTransactionManagerLookup()); dccc.clustering().hash().l1().disable().locking().lockAcquisitionTimeout(TestingUtil.shortTimeoutMillis()); dccc.clustering().stateTransfer().fetchInMemoryState(true); createCluster(dccc, 2); waitForClusterToForm(); }
CacheConfigurationServiceConfigurator(PathAddress address) { super(CONFIGURATION, address); this.memory = new ServiceSupplierDependency<>(CacheComponent.MEMORY.getServiceName(address)); this.expiration = new ServiceSupplierDependency<>(CacheComponent.EXPIRATION.getServiceName(address)); this.locking = new ServiceSupplierDependency<>(CacheComponent.LOCKING.getServiceName(address)); this.persistence = new ServiceSupplierDependency<>(CacheComponent.PERSISTENCE.getServiceName(address)); this.transaction = new ServiceSupplierDependency<>(CacheComponent.TRANSACTION.getServiceName(address)); this.module = new ServiceSupplierDependency<>(CacheComponent.MODULE.getServiceName(address)); String containerName = address.getParent().getLastElement().getValue(); String cacheName = address.getLastElement().getValue(); this.configurator = new ConfigurationServiceConfigurator(this.getServiceName(), containerName, cacheName, this.andThen(builder -> { GroupsConfigurationBuilder groupsBuilder = builder.clustering().hash().groups().enabled(); for (Grouper<?> grouper : this.module.get().loadService(Grouper.class)) { groupsBuilder.addGrouper(grouper); } })).require(this); }
private ConfigurationBuilder getConfigurationBuilder() { final ConfigurationBuilder conf = getDefaultClusteredCacheConfig(DIST_SYNC, false); conf.clustering().hash().keyPartitioner(new AffinityPartitioner()).numSegments(10).numOwners(1); return conf; }
private static ConfigurationBuilder createConfiguration() { ConfigurationBuilder builder = getDefaultClusteredCacheConfig(CacheMode.DIST_SYNC, false); builder.clustering().hash().numOwners(2); return builder; }
@Override protected ConfigurationBuilder buildConfiguration() { ConfigurationBuilder builder = super.buildConfiguration(); builder.clustering().hash(). consistentHashFactory(factory). numSegments(1); return builder; }
@Override protected void createCacheManagers() throws Throwable { cacheConfigBuilder = getDefaultClusteredCacheConfig(CacheMode.DIST_SYNC, true, true); cacheConfigBuilder.transaction().transactionMode(TransactionMode.TRANSACTIONAL) .transactionManagerLookup(new EmbeddedTransactionManagerLookup()) .lockingMode(LockingMode.PESSIMISTIC) .clustering().hash().numOwners(10) // a number bigger than actual number of nodes will make this distributed cluster behave as if fully replicated .stateTransfer().fetchInMemoryState(true) .awaitInitialTransfer(true); // setting this to false will lead to test failure createCluster(cacheConfigBuilder, 2); waitForClusterToForm(); }
@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 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); }
@Override protected ConfigurationBuilder buildConfiguration() { ConfigurationBuilder builder = super.buildConfiguration(); builder.clustering() .cacheMode(CacheMode.DIST_SYNC) .hash().numOwners(1); return builder; } }
@Override protected void createCacheManagers() throws Throwable { ConfigurationBuilder builder = getDefaultClusteredCacheConfig(CacheMode.REPL_SYNC, false); builder.clustering().hash().numSegments(60); createClusteredCaches(2, builder); }