Source:
public Object visitPutMapCommand(InvocationContext ctx, PutMapCommand command) throws Throwable { LocalizedCacheTopology cacheTopology = checkTopology(command); Map<Object, Object> originalMap = command.getMap(); if (command.hasAnyFlag(FlagBitSets.PUT_FOR_STATE_TRANSFER)) { extractAndSetMetadata(ctx, command, originalMap); return invokeNextThenAccept(ctx, command, putMapCommandHandler); } if (ctx.isOriginLocal()) { return invokeNextThenApply(ctx, command, (returnCtx, returnCommand, rv) -> handlePutMapOnOrigin(returnCtx, (PutMapCommand) returnCommand, rv, originalMap, cacheTopology)); } if (command.isForwarded()) { extractAndSetMetadata(ctx, command, originalMap); return invokeNextThenAccept(ctx, command, putMapCommandHandler); } else { ConsistentHash writeCH = cacheTopology.getWriteConsistentHash(); Map<Object, VersionedResult> versionMap = new HashMap<>(originalMap.size()); for (Map.Entry<Object, Object> entry : originalMap.entrySet()) { Object key = entry.getKey(); CacheEntry cacheEntry = ctx.lookupEntry(key); if (cacheEntry == null) { throw new IllegalStateException("Not wrapped " + key); } EntryVersion version = svm.incrementVersion(keyPartitioner.getSegment(key)); cacheEntry.setMetadata(addVersion(command.getMetadata(), version)); versionMap.put(key, new VersionedResult(null, version)); } command.setFlagsBitSet(command.getFlagsBitSet() & ~FlagBitSets.IGNORE_RETURN_VALUES); return invokeNextThenApply(ctx, command, (ctx1, command1, rv) -> { for (Object key : ((PutMapCommand) command1).getAffectedKeys()) { commitSingleEntryIfNewer(ctx1.lookupEntry(key), ctx1, command1); } if (rv instanceof Map) { Map<?, Object> resultMap = (Map<?, Object>) rv; for (Map.Entry<?, Object> entry : resultMap.entrySet()) { versionMap.compute(entry.getKey(), (k, vr) -> new VersionedResult(entry.getValue(), vr.version)); } } return versionMap; }); } }

Target:
public Object visitPutMapCommand(InvocationContext ctx, PutMapCommand command) throws Throwable { LocalizedCacheTopology cacheTopology = checkTopology(command); Map<Object, Object> originalMap = command.getMap(); if (command.hasAnyFlag(FlagBitSets.PUT_FOR_STATE_TRANSFER)) { extractAndSetMetadata(ctx, command, originalMap); return invokeNextThenAccept(ctx, command, putMapCommandHandler); } if (ctx.isOriginLocal()) { return invokeNextThenApply(ctx, command, (returnCtx, returnCommand, rv) -> handlePutMapOnOrigin(returnCtx, (PutMapCommand) returnCommand, rv, originalMap, cacheTopology)); } if (command.isForwarded()) { extractAndSetMetadata(ctx, command, originalMap); return invokeNextThenAccept(ctx, command, putMapCommandHandler); } else { Map<Object, VersionedResult> versionMap = new HashMap<>(originalMap.size()); for (Map.Entry<Object, Object> entry : originalMap.entrySet()) { Object key = entry.getKey(); CacheEntry cacheEntry = ctx.lookupEntry(key); if (cacheEntry == null) { throw new IllegalStateException("Not wrapped " + key); } EntryVersion version = svm.incrementVersion(keyPartitioner.getSegment(key)); cacheEntry.setMetadata(addVersion(command.getMetadata(), version)); versionMap.put(key, new VersionedResult(null, version)); } command.setFlagsBitSet(command.getFlagsBitSet() & ~FlagBitSets.IGNORE_RETURN_VALUES); return invokeNextThenApply(ctx, command, (ctx1, command1, rv) -> { for (Object key : ((PutMapCommand) command1).getAffectedKeys()) { commitSingleEntryIfNewer(ctx1.lookupEntry(key), ctx1, command1); } if (rv instanceof Map) { Map<?, Object> resultMap = (Map<?, Object>) rv; for (Map.Entry<?, Object> entry : resultMap.entrySet()) { versionMap.compute(entry.getKey(), (k, vr) -> new VersionedResult(entry.getValue(), vr.version)); } } return versionMap; }); } }