@BeforeClass public void setUp() { // create cache configuration ConfigurationBuilder cb = new ConfigurationBuilder(); cb.clustering().invocationBatching().enable() .clustering().cacheMode(CacheMode.DIST_SYNC) .clustering().stateTransfer().timeout(10000) .locking().lockAcquisitionTimeout(TestingUtil.shortTimeoutMillis()) .locking().isolationLevel(IsolationLevel.REPEATABLE_READ); configuration = cb.build(); mockExecutorService = mock(ExecutorService.class); cache = mock(Cache.class); when(cache.getName()).thenReturn("testCache"); rpcManager = mock(RpcManager.class); commandsFactory = mock(CommandsFactory.class); cacheNotifier = mock(ClusterCacheNotifier.class); persistenceManager = mock(PersistenceManager.class); dataContainer = mock(InternalDataContainer.class); transactionTable = mock(TransactionTable.class); stateTransferLock = mock(StateTransferLock.class); distributionManager = mock(DistributionManager.class); ef = mock(InternalEntryFactory.class); when(distributionManager.getCacheTopology()).thenAnswer(invocation -> cacheTopology); }
cb.clustering().invocationBatching().enable() .clustering().cacheMode(CacheMode.DIST_SYNC) .clustering().stateTransfer().timeout(10000) .locking().lockAcquisitionTimeout(TestingUtil.shortTimeoutMillis()) .locking().isolationLevel(IsolationLevel.REPEATABLE_READ);
.clustering().stateTransfer().awaitInitialTransfer(false) final Configuration replConfig = new ConfigurationBuilder() .clustering().cacheMode(CacheMode.REPL_SYNC) .clustering().hash().numSegments(NUM_SEGMENTS) .clustering().stateTransfer().awaitInitialTransfer(false) .build();
@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); }
public void testLargeClusterStart() throws Exception { final Configuration distConfig = new ConfigurationBuilder() .clustering().cacheMode(CacheMode.DIST_SYNC) .clustering().stateTransfer().awaitInitialTransfer(false) final Configuration replConfig = new ConfigurationBuilder() .clustering().cacheMode(CacheMode.REPL_SYNC) .clustering().hash().numSegments(NUM_SEGMENTS) .clustering().stateTransfer().awaitInitialTransfer(false) .build();
@BeforeMethod protected void setUp() throws Exception { ConfigurationBuilder configurationBuilder = TestCacheManagerFactory.getDefaultCacheConfiguration(true); configurationBuilder.transaction().invocationBatching().enable() .clustering().cacheMode(CacheMode.DIST_SYNC) .clustering().hash().numOwners(1) .clustering().stateTransfer().fetchInMemoryState(false); manager1 = TestCacheManagerFactory.createClusteredCacheManager(configurationBuilder); manager1.defineConfiguration("test", configurationBuilder.build()); cache1 = manager1.getCache("test").getAdvancedCache(); ex1 = Executors.newSingleThreadExecutor(getTestThreadFactory("KeyGenerator1")); keyAffinityService1 = KeyAffinityServiceFactory.newLocalKeyAffinityService(cache1, new RndKeyGenerator(), ex1, KEY_QUEUE_SIZE); log.trace("Address for manager1: " + manager1.getAddress()); manager2 = TestCacheManagerFactory.createClusteredCacheManager(configurationBuilder); manager2.defineConfiguration("test", configurationBuilder.build()); cache2 = manager2.getCache("test").getAdvancedCache(); ex2 = Executors.newSingleThreadExecutor(getTestThreadFactory("KeyGenerator2")); keyAffinityService2 = KeyAffinityServiceFactory.newLocalKeyAffinityService(cache2, new RndKeyGenerator(), ex2, KEY_QUEUE_SIZE); log.trace("Address for manager2: " + manager2.getAddress()); TestingUtil.blockUntilViewsReceived(60000, cache1, cache2); Thread.sleep(5000); }
@Override protected void createCacheManagers() throws Throwable { ConfigurationBuilder config = getDefaultClusteredCacheConfig(cacheMode, true); config .locking().lockAcquisitionTimeout(LOCK_TIMEOUT) .clustering().remoteTimeout(REPL_TIMEOUT) .clustering().hash().numOwners(numOwners) .transaction().transactionManagerLookup(new EmbeddedTransactionManagerLookup()) .transaction().completedTxTimeout(3600000); createCluster(config, 3); waitForClusterToForm(); failPrepareInterceptor = new FailPrepareInterceptor(); advancedCache(2).addInterceptor(failPrepareInterceptor, 1); }
private ConfigurationBuilder makeCfg() { ConfigurationBuilder cfg = new ConfigurationBuilder(); cfg.transaction() .transactionMode(TransactionMode.TRANSACTIONAL).invocationBatching().enable() .clustering().cacheMode(CacheMode.REPL_SYNC) .clustering().sync() .stateTransfer().fetchInMemoryState(true) .transaction().lockingMode(LockingMode.PESSIMISTIC) .locking().isolationLevel(IsolationLevel.READ_COMMITTED).useLockStriping(false) .customInterceptors().addInterceptor() .interceptor(new ProtobufMetadataManagerInterceptor()).after(PessimisticLockingInterceptor.class); return cfg; }