Source:
protected CompletableFuture<Void> remoteGetAll(InvocationContext ctx, GetAllCommand command, Map<Address, List<Object>> requestedKeys) { GlobalTransaction gtx = ctx.isInTxScope() ? ((TxInvocationContext) ctx).getGlobalTransaction() : null; BaseDistributionInterceptor.CompletableFutureWithCounter allFuture = new BaseDistributionInterceptor.CompletableFutureWithCounter(requestedKeys.size()); for (Map.Entry<Address, List<Object>> pair : requestedKeys.entrySet()) { List<Object> keys = pair.getValue(); ClusteredGetAllCommand clusteredGetAllCommand = cf.buildClusteredGetAllCommand(keys, command.getFlagsBitSet(), gtx); rpcManager.invokeRemotelyAsync(Collections.singleton(pair.getKey()), clusteredGetAllCommand, defaultSyncOptions).whenComplete((responseMap, throwable) -> { if (throwable != null) { allFuture.completeExceptionally(throwable); } Response response = getSingleSuccessfulResponseOrFail(responseMap, allFuture); if (response == null) return; Object responseValue = ((SuccessfulResponse) response).getResponseValue(); if (responseValue instanceof InternalCacheValue[]) { InternalCacheValue[] values = (InternalCacheValue[]) responseValue; int counterValue; synchronized (allFuture) { for (int i = 0; i < keys.size(); ++i) { Object key = keys.get(i); InternalCacheValue value = values[i]; CacheEntry entry = value == null ? NullCacheEntry.getInstance() : value.toInternalCacheEntry(key); wrapRemoteEntry(ctx, key, entry, false); } counterValue = --allFuture.counter; } if (counterValue == 0) { allFuture.complete(null); } } else { allFuture.completeExceptionally(new IllegalStateException("Unexpected response value: " + responseValue)); } }); } return allFuture; }

Target:
protected CompletableFuture<Void> remoteGetAll(InvocationContext ctx, GetAllCommand command, Map<Address, List<Object>> requestedKeys) { GlobalTransaction gtx = ctx.isInTxScope() ? ((TxInvocationContext) ctx).getGlobalTransaction() : null; CompletableFutureWithCounter allFuture = new CompletableFutureWithCounter(requestedKeys.size()); for (Map.Entry<Address, List<Object>> pair : requestedKeys.entrySet()) { List<Object> keys = pair.getValue(); ClusteredGetAllCommand clusteredGetAllCommand = cf.buildClusteredGetAllCommand(keys, command.getFlagsBitSet(), gtx); rpcManager.invokeRemotelyAsync(Collections.singleton(pair.getKey()), clusteredGetAllCommand, defaultSyncOptions).whenComplete((responseMap, throwable) -> { if (throwable != null) { allFuture.completeExceptionally(throwable); } Response response = getSingleSuccessfulResponseOrFail(responseMap, allFuture); if (response == null) return; Object responseValue = ((SuccessfulResponse) response).getResponseValue(); if (responseValue instanceof InternalCacheValue[]) { InternalCacheValue[] values = (InternalCacheValue[]) responseValue; int counterValue; synchronized (allFuture) { for (int i = 0; i < keys.size(); ++i) { Object key = keys.get(i); InternalCacheValue value = values[i]; CacheEntry entry = value == null ? NullCacheEntry.getInstance() : value.toInternalCacheEntry(key); wrapRemoteEntry(ctx, key, entry, false); } counterValue = --allFuture.counter; } if (counterValue == 0) { allFuture.complete(null); } } else { allFuture.completeExceptionally(new IllegalStateException("Unexpected response value: " + responseValue)); } }); } return allFuture; }