Source:
<code>private CompletableFuture<InternalCacheEntry> handleRemoteValue(Object key, InternalCacheEntry value, ClusteredGetCommand getCommand, RpcOptionsBuilder rpcOptionsBuilder, int lastTopologyId) { if (value != null) return CompletableFuture.completedFuture(value); final CacheTopology cacheTopology = stateTransferManager.getCacheTopology(); final int currentTopologyId = cacheTopology.getTopologyId(); if (trace) { log.tracef("Perform remote get for key %s. topologyId=%s, currentTopologyId=%s", key, lastTopologyId, currentTopologyId); } List<Address> targets; int newTopologyId; if (lastTopologyId < currentTopologyId) { newTopologyId = currentTopologyId; targets = new ArrayList<>(cacheTopology.getReadConsistentHash().locateOwners(key)); } else if (lastTopologyId == currentTopologyId && cacheTopology.getPendingCH() != null) { newTopologyId = currentTopologyId + 1; targets = new ArrayList<>(cacheTopology.getPendingCH().locateOwners(key)); targets.removeAll(cacheTopology.getReadConsistentHash().locateOwners(key)); if (targets.isEmpty()) { if (trace) { log.tracef("No valid values found for key '%s' (topologyId=%s).", key, currentTopologyId); } <START> return CompletableFuture.completedFuture(null); <END> } } else { if (trace) { log.tracef("No valid values found for key '%s' (topologyId=%s).", key, currentTopologyId); } return CompletableFuture.completedFuture(null); } return invokeClusterGetCommandRemotely(targets, rpcOptionsBuilder, getCommand, key).thenCompose( newValue -> handleRemoteValue(key, newValue, getCommand, rpcOptionsBuilder, newTopologyId)); }</code><technical_language>cache null completed future in CompletableFutures? :P</technical_language>

Target:
private CompletableFuture<InternalCacheEntry> handleRemoteValue(Object key, InternalCacheEntry value, ClusteredGetCommand getCommand, RpcOptionsBuilder rpcOptionsBuilder, int lastTopologyId) { if (value != null) return CompletableFuture.completedFuture(value); final CacheTopology cacheTopology = stateTransferManager.getCacheTopology(); final int currentTopologyId = cacheTopology.getTopologyId(); if (trace) { log.tracef("Perform remote get for key %s. topologyId=%s, currentTopologyId=%s", key, lastTopologyId, currentTopologyId); } List<Address> targets; int newTopologyId; if (lastTopologyId < currentTopologyId) { newTopologyId = currentTopologyId; targets = new ArrayList<>(cacheTopology.getReadConsistentHash().locateOwners(key)); } else if (lastTopologyId == currentTopologyId && cacheTopology.getPendingCH() != null) { newTopologyId = currentTopologyId + 1; targets = new ArrayList<>(cacheTopology.getPendingCH().locateOwners(key)); targets.removeAll(cacheTopology.getReadConsistentHash().locateOwners(key)); if (targets.isEmpty()) { if (trace) { log.tracef("No valid values found for key '%s' (topologyId=%s).", key, currentTopologyId); } return CompletableFutures.completedNull(); } } else { if (trace) { log.tracef("No valid values found for key '%s' (topologyId=%s).", key, currentTopologyId); } return CompletableFutures.completedNull(); } return invokeClusterGetCommandRemotely(targets, rpcOptionsBuilder, getCommand, key).thenCompose( newValue -> handleRemoteValue(key, newValue, getCommand, rpcOptionsBuilder, newTopologyId)); }