}
private void acquireRemoteIfNeeded(InvocationContext ctx, Set<Object> keys, FlagAffectedCommand command) throws Throwable {
if (ctx.isOriginLocal() && !command.hasFlag(Flag.CACHE_MODE_LOCAL)) {
final TxInvocationContext txContext = (TxInvocationContext) ctx;
LocalTransaction localTransaction = (LocalTransaction) txContext.getCacheTransaction();
if (localTransaction.getAffectedKeys().containsAll(keys)) {
log.tracef("We already have lock for keys %s, skip remote lock acquisition", keys);
return;
} else {
LockControlCommand lcc = cf.buildLockControlCommand(keys,
command.getFlags(), txContext.getGlobalTransaction());