@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); builder.clustering() .hash().capacityFactor(this.capacityFactor).numOwners(this.owners) .l1().enabled(this.l1Lifespan > 0).lifespan(this.l1Lifespan) ; } }
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 { 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 { 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() .transactionMode(TransactionMode.TRANSACTIONAL) .transactionManagerLookup(new EmbeddedTransactionManagerLookup()) .lockingMode(LockingMode.PESSIMISTIC); dccc.clustering().hash().numOwners(1).l1().disable(); dccc.locking().lockAcquisitionTimeout(TestingUtil.shortTimeoutMillis()); createCluster(dccc, CLUSTER_SIZE); waitForClusterToForm(); }
@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(); }
protected ConfigurationBuilder defaultRecoveryConfig() { ConfigurationBuilder builder = getDefaultClusteredCacheConfig(CacheMode.DIST_SYNC, true); builder.transaction().transactionManagerLookup(new EmbeddedTransactionManagerLookup()) .useSynchronization(false) .recovery().enable() .locking().useLockStriping(false) .clustering().hash().numOwners(2) .l1().disable() .stateTransfer().fetchInMemoryState(false); return builder; }
@Override protected void createCacheManagers() { GlobalConfigurationBuilder gcb = GlobalConfigurationBuilder.defaultClusteredBuilder(); if (useTriangle == Boolean.FALSE) { gcb.addModule(PrivateGlobalConfigurationBuilder.class).serverMode(true); } ConfigurationBuilder dcc = getDefaultClusteredCacheConfig(cacheMode, false); if (!cacheMode.isScattered()) { dcc.clustering().hash().numOwners(3).l1().disable(); } if (biasAcquisition != null) { dcc.clustering().biasAcquisition(biasAcquisition); } createCluster(gcb, dcc, 3); 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(); }
@Override protected void createCacheManagers() throws Throwable { ConfigurationBuilder configuration = getDefaultClusteredCacheConfig(CacheMode.DIST_SYNC, true); configuration.transaction().transactionManagerLookup(new EmbeddedTransactionManagerLookup()) .useSynchronization(false) .recovery().enable() .jmxStatistics().enable() .locking().useLockStriping(false) .clustering().hash().numOwners(3) .l1().disable(); EmbeddedCacheManager cm1 = TestCacheManagerFactory.createClusteredCacheManager(createGlobalConfigurationBuilder(), configuration, new TransportFlags(), true); EmbeddedCacheManager cm2 = TestCacheManagerFactory.createClusteredCacheManager(createGlobalConfigurationBuilder(), configuration, new TransportFlags(), true); EmbeddedCacheManager cm3 = TestCacheManagerFactory.createClusteredCacheManager(createGlobalConfigurationBuilder(), configuration, new TransportFlags(), true); registerCacheManager(cm1, cm2, cm3); defineConfigurationOnAllManagers("test", configuration); cache(0, "test"); cache(1, "test"); cache(2, "test"); TestingUtil.waitForNoRebalance(caches("test")); threadMBeanServer = PerThreadMBeanServerLookup.getThreadMBeanServer(); assert showInDoubtTransactions(0).isEmpty(); assert showInDoubtTransactions(1).isEmpty(); assert showInDoubtTransactions(2).isEmpty(); tx1 = beginAndSuspendTx(cache(2, "test")); prepareTransaction(tx1); log.trace("Shutting down a cache " + address(cache(2, "test"))); TestingUtil.killCacheManagers(manager(2)); TestingUtil.blockUntilViewsReceived(90000, false, cache(0, "test"), cache(1, "test")); }
@Override protected void createCacheManagers() { cacheConfigBuilder = getDefaultClusteredCacheConfig(cacheMode, transactional, true); if (transactional) { cacheConfigBuilder.transaction().transactionMode(TransactionMode.TRANSACTIONAL) .transactionManagerLookup(new EmbeddedTransactionManagerLookup()); cacheConfigBuilder.transaction().lockingMode(lockingMode); if (lockingMode == LockingMode.OPTIMISTIC) { cacheConfigBuilder.locking().isolationLevel(IsolationLevel.REPEATABLE_READ); } } if (biasAcquisition != null) { cacheConfigBuilder.clustering().biasAcquisition(biasAcquisition); } cacheConfigBuilder.clustering().hash().numSegments(10) .l1().disable() .locking().lockAcquisitionTimeout(TestingUtil.shortTimeoutMillis()); cacheConfigBuilder.clustering().stateTransfer().fetchInMemoryState(true).awaitInitialTransfer(false); addClusterEnabledCacheManager(cacheConfigBuilder); waitForClusterToForm(); }
@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 }
.numOwners(owners) .numSegments(config.getInt("sessionsSegments", 60)) .l1() .enabled(l1Enabled) .lifespan(l1Lifespan)