Source:
protected void putAllInternal(Map<Data, Data> map, @Nullable InternalCompletableFuture<Void> future) { try { int mapSize = map.size(); if (mapSize == 0) { if (future != null) { future.complete(null); } return; } int partitionCount = partitionService.getPartitionCount(); int initialSize = getPutAllInitialSize(false, mapSize, partitionCount); Map<Address, List<Integer>> memberPartitionsMap = partitionService.getMemberPartitionsMap(); MapEntries[] entriesPerPartition = new MapEntries[partitionCount]; for (Map.Entry<Data, Data> entry : map.entrySet()) { checkNotNull(entry.getKey(), NULL_KEY_IS_NOT_ALLOWED); checkNotNull(entry.getValue(), NULL_VALUE_IS_NOT_ALLOWED); Data keyData = entry.getKey(); int partitionId = partitionService.getPartitionId(keyData); MapEntries entries = entriesPerPartition[partitionId]; if (entries == null) { entries = new MapEntries(initialSize); entriesPerPartition[partitionId] = entries; } entries.add(keyData, toData(entry.getValue())); } AtomicInteger counter = new AtomicInteger(memberPartitionsMap.size()); InternalCompletableFuture<Void> resultFuture = future != null ? future : new InternalCompletableFuture<>(); BiConsumer<Void, Throwable> callback = (response, t) -> { if (t != null) { resultFuture.completeExceptionally(t); } if (counter.decrementAndGet() == 0) { if (!resultFuture.isDone()) { resultFuture.complete(null); } } }; for (Map.Entry<Address, List<Integer>> entry : memberPartitionsMap.entrySet()) { invokePutAllOperation(entry.getKey(), entry.getValue(), entriesPerPartition).whenCompleteAsync(callback); } if (future == null) { resultFuture.get(); } } catch (Throwable e) { throw rethrow(e); } }

Target:
protected void putAllInternal(Map<Data, Data> map, @Nullable InternalCompletableFuture<Void> future) { try { int mapSize = map.size(); if (mapSize == 0) { if (future != null) { future.complete(null); } return; } int partitionCount = partitionService.getPartitionCount(); int initialSize = getPutAllInitialSize(mapSize, partitionCount); Map<Address, List<Integer>> memberPartitionsMap = partitionService.getMemberPartitionsMap(); MapEntries[] entriesPerPartition = new MapEntries[partitionCount]; for (Map.Entry<Data, Data> entry : map.entrySet()) { checkNotNull(entry.getKey(), NULL_KEY_IS_NOT_ALLOWED); checkNotNull(entry.getValue(), NULL_VALUE_IS_NOT_ALLOWED); Data keyData = entry.getKey(); int partitionId = partitionService.getPartitionId(keyData); MapEntries entries = entriesPerPartition[partitionId]; if (entries == null) { entries = new MapEntries(initialSize); entriesPerPartition[partitionId] = entries; } entries.add(keyData, entry.getValue()); } AtomicInteger counter = new AtomicInteger(memberPartitionsMap.size()); InternalCompletableFuture<Void> resultFuture = future != null ? future : new InternalCompletableFuture<>(); BiConsumer<Void, Throwable> callback = (response, t) -> { if (t != null) { resultFuture.completeExceptionally(t); } if (counter.decrementAndGet() == 0) { if (!resultFuture.isDone()) { resultFuture.complete(null); } } }; for (Map.Entry<Address, List<Integer>> entry : memberPartitionsMap.entrySet()) { invokePutAllOperation(entry.getKey(), entry.getValue(), entriesPerPartition).whenCompleteAsync(callback); } if (future == null) { resultFuture.get(); } } catch (Throwable e) { throw rethrow(e); } }