Source:
protected final void testFineGrainedAtomicHashMap(boolean executeOnLockOwner) throws Exception { final int txExecutor = executeOnLockOwner ? 0 : 1; FineGrainedAtomicMap<Object, Object> map = AtomicMapLookup.getFineGrainedAtomicMap(cache(txExecutor), fgahmKey); tm(txExecutor).begin(); for (int keyIndex = 0; keyIndex < 100; ++keyIndex) { map.put("key" + keyIndex, VALUE); } final Transaction tx1 = tm(txExecutor).suspend(); Assert.assertEquals(collectors[txExecutor].getKeys().size(), 100, "Wrong number of composite keys collected!"); log.infof("%s composite keys collected.", collectors[txExecutor].getKeys().size()); ControlledRpcManager rpcManager = ControlledRpcManager.replaceRpcManager(cache(txExecutor)); try { Future<Boolean> txOutcome = fork(() -> { try { tm(txExecutor).resume(tx1); tm(txExecutor).commit(); return Boolean.TRUE; } catch (Exception e) { return Boolean.FALSE; } }); ControlledRpcManager.BlockedRequest blockedPrepare = rpcManager.expectCommand(prepareCommandClass); ControlledRpcManager.BlockedResponseMap blockedPrepareResponses = null; if (!pessimistic) { blockedPrepareResponses = blockedPrepare.send().awaitAll(); } assertKeysLocked(0, collectors[txExecutor].getKeys().toArray()); assertKeysLocked(1, EMPTY_ARRAY); assertKeysLocked(2, EMPTY_ARRAY); if (pessimistic) { blockedPrepare.send().receiveAll(); } else { blockedPrepareResponses.receive(); } rpcManager.expectCommand(TxCompletionNotificationCommand.class).sendWithoutResponses(); Assert.assertTrue(txOutcome.get()); } finally { rpcManager.stopBlocking(); rpcManager.revertRpcManager(cache(txExecutor)); } }

Target:
protected final void testFineGrainedAtomicHashMap(boolean executeOnLockOwner) throws Exception { final int txExecutor = executeOnLockOwner ? 0 : 1; FineGrainedAtomicMap<Object, Object> map = AtomicMapLookup.getFineGrainedAtomicMap(cache(txExecutor), fgahmKey); tm(txExecutor).begin(); for (int keyIndex = 0; keyIndex < 100; ++keyIndex) { map.put("key" + keyIndex, VALUE); } final Transaction tx1 = tm(txExecutor).suspend(); Assert.assertEquals(collectors[txExecutor].getKeys().size(), 100, "Wrong number of composite keys collected!"); log.infof("%s composite keys collected.", collectors[txExecutor].getKeys().size()); ControlledRpcManager rpcManager = ControlledRpcManager.replaceRpcManager(cache(txExecutor)); try { Future<Boolean> txOutcome = fork(() -> { try { tm(txExecutor).resume(tx1); tm(txExecutor).commit(); return Boolean.TRUE; } catch (Exception e) { return Boolean.FALSE; } }); ControlledRpcManager.BlockedRequest blockedPrepare = rpcManager.expectCommand(prepareCommandClass); ControlledRpcManager.BlockedResponseMap blockedPrepareResponses = null; if (!pessimistic) { blockedPrepareResponses = blockedPrepare.send().awaitAll(); } assertKeysLocked(0, collectors[txExecutor].getKeys().toArray()); assertKeysLocked(1, EMPTY_ARRAY); assertKeysLocked(2, EMPTY_ARRAY); if (pessimistic) { blockedPrepare.send().receiveAll(); } else { blockedPrepareResponses.receive(); rpcManager.expectCommand(VersionedCommitCommand.class).send().receiveAll(); } rpcManager.expectCommand(TxCompletionNotificationCommand.class).sendWithoutResponses(); Assert.assertTrue(txOutcome.get()); } finally { rpcManager.revertRpcManager(); } }