Source:
public CompletableFuture<Map<Address, Response>> invokeRemotelyAsync(Collection<Address> recipients, ReplicableCommand rpc, RpcOptions options) { if (trace) log.tracef("%s invoking %s to recipient list %s with options %s", t.getAddress(), rpc, recipients, options); if (!configuration.clustering().cacheMode().isClustered()) throw new IllegalStateException("Trying to invoke a remote command but the cache is not clustered"); setTopologyId(rpc); CacheRpcCommand cacheRpc = rpc instanceof CacheRpcCommand ? (CacheRpcCommand) rpc : cf.buildSingleRpcCommand(rpc); long startTimeNanos = statisticsEnabled ? timeService.time() : 0; CompletableFuture<Map<Address, Response>> invocation; try { invocation = t.invokeRemotelyAsync(recipients, cacheRpc, options.responseMode(), options.timeUnit().toMillis(options.timeout()), options.responseFilter(), options.deliverOrder(), configuration.clustering().cacheMode().isDistributed()); } catch (Exception e) { log.unexpectedErrorReplicating(e); if (statisticsEnabled) replicationFailures.incrementAndGet(); return rethrowAsCacheException(e); } return invocation.handle((responseMap, throwable) -> { ReplicableCommand cmd = rpc; if (statisticsEnabled) { long timeTaken = timeService.timeDuration(startTimeNanos, TimeUnit.MILLISECONDS); totalReplicationTime.getAndAdd(timeTaken); } if (throwable == null) { if (statisticsEnabled) replicationCount.incrementAndGet(); if (trace) log.tracef("Response(s) to %s is %s", rpc, responseMap); return responseMap; } else { if (statisticsEnabled) replicationFailures.incrementAndGet(); return rethrowAsCacheException(throwable); } }); }

Target:
public CompletableFuture<Map<Address, Response>> invokeRemotelyAsync(Collection<Address> recipients, ReplicableCommand rpc, RpcOptions options) { if (trace) log.tracef("%s invoking %s to recipient list %s with options %s", t.getAddress(), rpc, recipients, options); if (!configuration.clustering().cacheMode().isClustered()) throw new IllegalStateException("Trying to invoke a remote command but the cache is not clustered"); setTopologyId(rpc); CacheRpcCommand cacheRpc = rpc instanceof CacheRpcCommand ? (CacheRpcCommand) rpc : cf.buildSingleRpcCommand(rpc); long startTimeNanos = statisticsEnabled ? timeService.time() : 0; CompletableFuture<Map<Address, Response>> invocation; try { invocation = t.invokeRemotelyAsync(recipients, cacheRpc, options.responseMode(), options.timeUnit().toMillis(options.timeout()), options.responseFilter(), options.deliverOrder(), configuration.clustering().cacheMode().isDistributed()); } catch (Exception e) { log.unexpectedErrorReplicating(e); if (statisticsEnabled) replicationFailures.incrementAndGet(); return rethrowAsCacheException(e); } return invocation.handle((responseMap, throwable) -> { if (statisticsEnabled) { long timeTaken = timeService.timeDuration(startTimeNanos, TimeUnit.MILLISECONDS); totalReplicationTime.getAndAdd(timeTaken); } if (throwable == null) { if (statisticsEnabled) replicationCount.incrementAndGet(); if (trace) log.tracef("Response(s) to %s is %s", rpc, responseMap); return responseMap; } else { if (statisticsEnabled) replicationFailures.incrementAndGet(); return rethrowAsCacheException(throwable); } }); }