@AfterMethod public void cleanup() { rpcManager0.excludeCommands(ClearCommand.class); IntStream.of(0, 1, 2).mapToObj(this::cache).forEach(Cache::clear); rpcManager0.excludeCommands(); }
controlledRpcManager.excludeCommands(StateRequestCommand.class, StateResponseCommand.class);
controlledRpcManager.excludeCommands(ClusteredGetAllCommand.class, InvalidateVersionsCommand.class, PutKeyValueCommand.class, PutMapCommand.class);
public void testBiasLeaseRenewed() throws Exception { MagicKey key = new MagicKey(cache(0)); rpcManager0.excludeCommands(ExceptionAckCommand.class); cache(1).put(key, "v0"); assertEquals(Collections.singletonList(address(1)), biasManager(0).getRemoteBias(key)); assertTrue(biasManager(1).hasLocalBias(key)); for (int i = 0; i < 3; ++i) { CountDownLatch latch = new CountDownLatch(1); handler0.latch = latch; timeService.advance(BIAS_LIFESPAN - 1); rpcManager1.resetStats(); assertEquals("v0", cache(1).get(key)); assertEquals(0, rpcManager1.clusterGet); assertTrue(latch.await(30, TimeUnit.SECONDS)); assertEquals(Collections.singletonList(address(1)), biasManager(0).getRemoteBias(key)); } }
crm.excludeCommands(StateRequestCommand.class, PrepareCommand.class, CommitCommand.class, TxCompletionNotificationCommand.class);
private void testLockMigrationDuringPrepare(final Object key) throws Exception { ControlledRpcManager controlledRpcManager = ControlledRpcManager.replaceRpcManager(originatorCache); controlledRpcManager.excludeCommands(StateRequestCommand.class, StateResponseCommand.class); final EmbeddedTransactionManager tm = embeddedTm(ORIGINATOR_INDEX); controlledRpcManager.excludeCommands(CommitCommand.class, TxCompletionNotificationCommand.class); tm.resume(tx); tx.runCommit(false);
public void testBiasTimesOut() throws Exception { rpcManager0.excludeCommands(ExceptionAckCommand.class); MagicKey key = new MagicKey(cache(0)); cache(1).put(key, "v0"); assertTrue(biasManager(1).hasLocalBias(key)); timeService.advance(BIAS_LIFESPAN + 1); rpcManager0.expectCommand(RevokeBiasCommand.class).send().receiveAll(); // The local bias is invalidated synchronously with the sync command, but it may take few moments // to remove the remote bias. assertFalse(biasManager(1).hasLocalBias(key)); eventuallyEquals(null, () -> biasManager(0).getRemoteBias(key)); }
public void testNoEntryInL1PutReplacedNullValueConcurrently() throws InterruptedException, ExecutionException, TimeoutException { final Cache<Object, String> nonOwnerCache = getFirstNonOwner(key); final Cache<Object, String> ownerCache = getFirstOwner(key); ControlledRpcManager crm = ControlledRpcManager.replaceRpcManager(nonOwnerCache); crm.excludeCommands(ClusteredGetCommand.class); try { Future<String> future = fork(() -> nonOwnerCache.putIfAbsent(key, firstValue)); // Now wait for the get to return and block it for now ControlledRpcManager.BlockedResponseMap blockedPutResponses = crm.expectCommand(PutKeyValueCommand.class).send().expectAllResponses(); // Owner should have the new value assertEquals(firstValue, ownerCache.remove(key)); // Now let owner key->updateValue go through blockedPutResponses.receive(); // This should be originalValue still as we did the get assertNull(future.get(5, TimeUnit.SECONDS)); // Remove the interceptor now since we don't want to block ourselves - if using phaser this isn't required removeAllBlockingInterceptorsFromCache(nonOwnerCache); assertIsNotInL1(nonOwnerCache, key); // The nonOwnerCache should retrieve new value as it isn't in L1 assertNull(nonOwnerCache.get(key)); assertIsNotInL1(nonOwnerCache, key); } finally { crm.revertRpcManager(); } }
blockingRpcManager0.excludeCommands(WriteCommand.class, BackupWriteCommand.class, RevokeBiasCommand.class, InvalidateVersionsCommand.class, AbstractTransactionBoundaryCommand.class,
public void test() throws InterruptedException, ExecutionException, TimeoutException { ControlledRpcManager crm4 = ControlledRpcManager.replaceRpcManager(cache(4)); crm4.excludeCommands(StateRequestCommand.class, StateResponseCommand.class);
crm2.excludeCommands(ClusteredGetCommand.class); for (int i = 0; i < keys.length; i++) { MagicKey key = keys[i];
rpcManager2.excludeCommands(StateResponseCommand.class, ClusteredGetCommand.class);
private void testLockMigrationDuringCommit(final Object key) throws Exception { ControlledRpcManager controlledRpcManager = ControlledRpcManager.replaceRpcManager(originatorCache); controlledRpcManager.excludeCommands(StateRequestCommand.class, StateResponseCommand.class); final EmbeddedTransactionManager tm = embeddedTm(ORIGINATOR_INDEX);
ControlledRpcManager blockingRpcManager2 = ControlledRpcManager.replaceRpcManager(nonOwnerCache); blockingRpcManager0.excludeCommands(BackupWriteCommand.class, PrepareCommand.class, CommitCommand.class, TxCompletionNotificationCommand.class ); blockingRpcManager2.excludeCommands(BackupAckCommand.class);
crm.excludeCommands(StateRequestCommand.class, StateResponseCommand.class);
blockingRpcManager0.excludeCommands(BackupWriteCommand.class, BackupAckCommand.class);