ControlledRpcManager.BlockedResponseMap blockedPrepareResponses = null; if (!pessimistic) { blockedPrepareResponses = blockedPrepare.send().expectAllResponses();
ControlledRpcManager.BlockedResponseMap blockedPrepareResponses = null; if (!pessimistic) { blockedPrepareResponses = blockedPrepare.send().expectAllResponses();
() -> wfti.distributionManager.getCacheTopology().getTopologyId()); ControlledRpcManager.BlockedResponseMap blockedGet = sentGet.expectAllResponses(); int succesful = 0; for (Map.Entry<Address, Response> rsp : blockedGet.getResponses().entrySet()) {
firstRemoteGet.expectAllResponses().receiveAsync(); for (int i = 1; i < expectRemoteGets; ++i) { crm2.expectCommand(BaseClusteredReadCommand.class).send().receiveAll(); sentPrepare.expectAllResponses().receiveAsync(); crm0.expectCommand(CommitCommand.class).send().receiveAll(); crm0.expectCommand(TxCompletionNotificationCommand.class).send();
nodeARpcManager.expectCommand(VersionedPrepareCommand.class).send().expectAllResponses(); assertEquals(0, nodeC.commandLatch.getCount());
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(); } }
private void performTestOn(final Operation operation) throws Exception { final Object key = getKeyForCache(cache(0), cache(1)); cache(0).put(key, "v1"); assertKeyValue(key, "v1"); final ControlledRpcManager controlledRpcManager = ControlledRpcManager.replaceRpcManager(cache(1)); Future<Void> future = fork(() -> { operation.execute(cache(1), key, "v2"); return null; }); ControlledRpcManager.BlockedResponseMap blockedResponses = operation.expectCommand(controlledRpcManager) .send().expectAllResponses(); cache(0).put(key, "v3"); blockedResponses.receive(); future.get(); controlledRpcManager.stopBlocking(); assertKeyValue(key, "v3"); }
/** * Wait for all the responses and process them. */ public void receiveAll() { expectAllResponses().receive(); }