Source:
<code>private CompletableFuture<Void> replicateAndInvalidate(CacheTopology cacheTopology) { Address nextMember = getNextMember(cacheTopology); if (nextMember != null) { HashSet<Address> otherMembers = new HashSet<>(cacheTopology.getActualMembers()); Address localAddress = rpcManager.getAddress(); otherMembers.remove(localAddress); otherMembers.remove(nextMember); IntSet oldSegments; if (cacheTopology.getCurrentCH().getMembers().contains(localAddress)) { oldSegments = IntSets.from(cacheTopology.getCurrentCH().getSegmentsForOwner(localAddress)); oldSegments.retainAll(cacheTopology.getPendingCH().getSegmentsForOwner(localAddress)); } else { log.trace("Local address is not a member of currentCH, returning"); return CompletableFutures.completedNull(); } log.trace("Segments to replicate and invalidate: " + oldSegments); if (oldSegments.isEmpty()) { return CompletableFutures.completedNull(); } AtomicInteger outboundInvalidations = new AtomicInteger(1); CompletableFuture<Void> invalidationFuture = new CompletableFuture<>(); OutboundTransferTask outboundTransferTask = new OutboundTransferTask(nextMember, oldSegments, cacheTopology.getCurrentCH().getNumSegments(), chunkSize, cacheTopology.getTopologyId(), keyPartitioner, chunks -> invalidateChunks(chunks, otherMembers, outboundInvalidations, invalidationFuture, cacheTopology), OutboundTransferTask::defaultMapEntryFromDataContainer, OutboundTransferTask::defaultMapEntryFromStore, dataContainer, persistenceManager, rpcManager, commandsFactory, entryFactory, <START> timeout, cacheName, true, true); <END> outboundTransferTask.execute().whenComplete((ignored, throwable) -> { if (outboundInvalidations.decrementAndGet() == 0) { invalidationFuture.complete(null); } }); return invalidationFuture; } else { return CompletableFutures.completedNull(); } }</code><technical_language>want log if throwable is null</technical_language>

Target:
private CompletableFuture<Void> replicateAndInvalidate(CacheTopology cacheTopology) { Address nextMember = getNextMember(cacheTopology); if (nextMember != null) { HashSet<Address> otherMembers = new HashSet<>(cacheTopology.getActualMembers()); Address localAddress = rpcManager.getAddress(); otherMembers.remove(localAddress); otherMembers.remove(nextMember); IntSet oldSegments; if (cacheTopology.getCurrentCH().getMembers().contains(localAddress)) { oldSegments = IntSets.from(cacheTopology.getCurrentCH().getSegmentsForOwner(localAddress)); oldSegments.retainAll(cacheTopology.getPendingCH().getSegmentsForOwner(localAddress)); } else { log.trace("Local address is not a member of currentCH, returning"); return CompletableFutures.completedNull(); } log.trace("Segments to replicate and invalidate: " + oldSegments); if (oldSegments.isEmpty()) { return CompletableFutures.completedNull(); } AtomicInteger outboundInvalidations = new AtomicInteger(1); CompletableFuture<Void> invalidationFuture = new CompletableFuture<>(); OutboundTransferTask outboundTransferTask = new OutboundTransferTask(nextMember, oldSegments, cacheTopology.getCurrentCH().getNumSegments(), chunkSize, cacheTopology.getTopologyId(), keyPartitioner, chunks -> invalidateChunks(chunks, otherMembers, outboundInvalidations, invalidationFuture, cacheTopology), rpcManager, commandsFactory, timeout, cacheName, true, true); outboundTransferTask.execute(Flowable.concat(publishDataContainerEntries(oldSegments), publishStoreEntries(oldSegments))) .whenComplete((ignored, throwable) -> { if (throwable != null) { logError(outboundTransferTask, throwable); } if (outboundInvalidations.decrementAndGet() == 0) { invalidationFuture.complete(null); } }); return invalidationFuture; } else { return CompletableFutures.completedNull(); } }