// We need this method in here because of putForExternalRead protected final BasicInvocationStage visitNonTxDataWriteCommand( InvocationContext ctx, DataWriteCommand command) throws Throwable { if (hasSkipLocking(command) || !shouldLockKey(command.getKey())) { return invokeNext(ctx, command); } try { lockAndRecord(ctx, command.getKey(), getLockTimeoutMillis(command)); } catch (Throwable t) { lockManager.unlockAll(ctx); throw t; } return invokeNext(ctx, command).handle(unlockAllReturnHandler); }
/** * Locks the value for the keys accessed by the command to avoid being override from a remote get. */ private CompletableFuture<Void> setSkipRemoteGetsAndInvokeNextForDataCommand( InvocationContext context, DataWriteCommand command, Metadata metadata) throws Throwable { Object retVal = invokeNextAndApplyChanges(context, command, metadata); if (context.isInTxScope()) { CacheEntry entry = context.lookupEntry(command.getKey()); if (entry != null) { entry.setSkipLookup(true); } } return context.shortCircuit(retVal); }