@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) ; } }
@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()); } } }
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); }
@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 configuration() { ConfigurationBuilder builder = getDefaultClusteredCacheConfig(CacheMode.DIST_SYNC, false); builder.clustering() .hash() .numSegments(1) .numOwners(1) .consistentHashFactory(new SingleKeyConsistentHashFactory()) .stateTransfer() .timeout(30, TimeUnit.SECONDS); return builder; }
@Override protected void createCacheManagers() throws Throwable { ConfigurationBuilder configurationBuilder = getDefaultClusteredCacheConfig(CacheMode.DIST_SYNC, true); configurationBuilder.transaction() .transactionMode(TransactionMode.TRANSACTIONAL) .lockingMode(LockingMode.PESSIMISTIC) .locking().lockAcquisitionTimeout(TestingUtil.shortTimeoutMillis()); configurationBuilder.clustering().hash().numOwners(1).groups().enabled(); createClusteredCaches(2, "atomic", configurationBuilder); }
@Override protected ConfigurationBuilder buildConfiguration() { ConfigurationBuilder builder = super.buildConfiguration(); builder.clustering() .cacheMode(CacheMode.DIST_SYNC) .hash().numOwners(1); return builder; } }
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; }
switch (attribute) { case FACTORY: builder.clustering().hash().consistentHashFactory(Util.<ConsistentHashFactory>getInstance(value, holder.getClassLoader())); break; case HASH_FUNCTION_CLASS: builder.clustering().hash().hash(Util.<Hash>getInstance(value, holder.getClassLoader())); break; case NUM_OWNERS: builder.clustering().hash().numOwners(Integer.parseInt(value)); break; case NUM_SEGMENTS: builder.clustering().hash().numSegments(Integer.parseInt(value)); break; case CAPACITY_FACTOR: builder.clustering().hash().capacityFactor(Float.parseFloat(value)); break; default:
@Override protected void createCacheManagers() throws Throwable { ConfigurationBuilder dcc = getDefaultClusteredCacheConfig(CacheMode.DIST_SYNC, true); dcc.clustering().hash().numOwners(1).l1().disable(); dcc.locking().transaction().transactionMode(TransactionMode.TRANSACTIONAL); createCluster(dcc, 4); waitForClusterToForm(); }
@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(); }
private ConfigurationBuilder getConfigurationBuilder() { final ConfigurationBuilder conf = getDefaultClusteredCacheConfig(DIST_SYNC, false); conf.clustering().hash().keyPartitioner(new AffinityPartitioner()).numSegments(10).numOwners(1); return conf; }
.numOwners(owners) .numSegments(segments) .capacityFactor(capacityFactor)
@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); }
private ConfigurationBuilder configuration() { ConfigurationBuilder configurationBuilder = getDefaultClusteredCacheConfig(CacheMode.REPL_SYNC, true); configurationBuilder.clustering().hash().numSegments(60); configurationBuilder.transaction() .transactionMode(TransactionMode.TRANSACTIONAL) .lockingMode(LockingMode.OPTIMISTIC) .locking().lockAcquisitionTimeout(TestingUtil.shortTimeoutMillis()) .isolationLevel(IsolationLevel.REPEATABLE_READ) .clustering().hash().numOwners(2).groups().enabled() .stateTransfer().fetchInMemoryState(false); return configurationBuilder; }
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 { 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(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 }
@Override protected void createCacheManagers() throws Throwable { ConfigurationBuilder configurationBuilder = getDefaultClusteredCacheConfig(CacheMode.REPL_SYNC, true); configurationBuilder.clustering().hash().numSegments(60).groups().enabled(); configurationBuilder.transaction() .transactionMode(TransactionMode.TRANSACTIONAL).transactionManagerLookup(new EmbeddedTransactionManagerLookup()) .lockingMode(LockingMode.PESSIMISTIC) .locking().lockAcquisitionTimeout(TestingUtil.shortTimeoutMillis()); createClusteredCaches(2, "atomic", configurationBuilder); }
@Override protected void createCacheManagers() throws Throwable { ConfigurationBuilder config = getDefaultClusteredCacheConfig(CacheMode.DIST_SYNC, true); config.clustering().hash().numOwners(1).transaction().transactionManagerLookup(new EmbeddedTransactionManagerLookup()); createCluster(config, 2); waitForClusterToForm(); }
@Override protected void createCacheManagers() throws Throwable { ConfigurationBuilder cfg = getDefaultClusteredCacheConfig(CacheMode.DIST_SYNC, true); cfg.clustering().hash().numOwners(NUM_CACHES) .locking().lockAcquisitionTimeout(TestingUtil.shortTimeoutMillis()); for (int i = 0; i < NUM_CACHES; i++) { EmbeddedCacheManager cm = TestCacheManagerFactory.createClusteredCacheManager(cfg); registerCacheManager(cm); } waitForClusterToForm(); }