Source:
private Object handleDataWriteCommand(InvocationContext ctx, DataWriteCommand command, boolean assumeOriginKeptEntryInL1) { if (command.hasAnyFlag(FlagBitSets.CACHE_MODE_LOCAL)) { if (trace) { log.tracef("local mode forced, suppressing L1 calls."); } return invokeNext(ctx, command); } CompletableFuture<?> l1InvalidationFuture = invalidateL1InCluster(ctx, command, assumeOriginKeptEntryInL1); return invokeNextAndHandle(ctx, command, (InvocationContext rCtx, VisitableCommand rCommand, Object rv, Throwable ex) -> { DataWriteCommand dataWriteCommand = (DataWriteCommand) rCommand; if (ex != null) { if (l1InvalidationFuture != null && !l1InvalidationFuture.isDone() && isSynchronous(dataWriteCommand) ) { return asyncValue(l1InvalidationFuture).thenApply(rCtx, rCommand, (rCtx1, rCommand1, rv1) -> { throw ex; }); } else { throw ex; } } else { if (l1InvalidationFuture != null && !l1InvalidationFuture.isDone() && isSynchronous(dataWriteCommand)) { if (shouldRemoveFromLocalL1(rCtx, dataWriteCommand)) { VisitableCommand removeFromL1Command = removeFromL1Command(rCtx, dataWriteCommand.getKey()); makeStage(asyncInvokeNext(rCtx, removeFromL1Command, l1InvalidationFuture)) .thenApply(null, null, (rCtx2, rCommand2, rv2) -> rv); } else { return asyncValue(l1InvalidationFuture).thenApply(rCtx, rCommand, (rCtx1, rCommand1, rv1) -> rv); } } else if (shouldRemoveFromLocalL1(rCtx, dataWriteCommand)) { VisitableCommand removeFromL1Command = removeFromL1Command(rCtx, dataWriteCommand.getKey()); return invokeNextThenApply(rCtx, removeFromL1Command, (rCtx2, rCommand2, rv2) -> rv); } else if (trace) { log.trace("Allowing entry to commit as local node is owner"); } } return rv; }); }

Target:
private Object handleDataWriteCommand(InvocationContext ctx, DataWriteCommand command, boolean assumeOriginKeptEntryInL1) { if (command.hasAnyFlag(FlagBitSets.CACHE_MODE_LOCAL)) { if (trace) { log.tracef("local mode forced, suppressing L1 calls."); } return invokeNext(ctx, command); } CompletableFuture<?> l1InvalidationFuture = invalidateL1InCluster(ctx, command, assumeOriginKeptEntryInL1); return invokeNextAndHandle(ctx, command, (InvocationContext rCtx, VisitableCommand rCommand, Object rv, Throwable ex) -> { DataWriteCommand dataWriteCommand = (DataWriteCommand) rCommand; if (ex != null) { if (mustSyncInvalidation(l1InvalidationFuture, dataWriteCommand)) { return asyncValue(l1InvalidationFuture).thenApply(rCtx, rCommand, (rCtx1, rCommand1, rv1) -> { throw ex; }); } throw ex; } else { if (mustSyncInvalidation(l1InvalidationFuture, dataWriteCommand)) { if (shouldRemoveFromLocalL1(rCtx, dataWriteCommand)) { VisitableCommand removeFromL1Command = removeFromL1Command(rCtx, dataWriteCommand.getKey()); return makeStage(asyncInvokeNext(rCtx, removeFromL1Command, l1InvalidationFuture)) .thenApply(null, null, (rCtx2, rCommand2, rv2) -> rv); } else { return asyncValue(l1InvalidationFuture).thenApply(rCtx, rCommand, (rCtx1, rCommand1, rv1) -> rv); } } else if (shouldRemoveFromLocalL1(rCtx, dataWriteCommand)) { VisitableCommand removeFromL1Command = removeFromL1Command(rCtx, dataWriteCommand.getKey()); return invokeNextThenApply(rCtx, removeFromL1Command, (rCtx2, rCommand2, rv2) -> rv); } else if (trace) { log.trace("Allowing entry to commit as local node is owner"); } } return rv; }); }