@Override
public final MVCCEntry wrapEntryForPut(InvocationContext ctx, Object key, InternalCacheEntry icEntry,
boolean undeleteIfNeeded, FlagAffectedCommand cmd) throws InterruptedException {
CacheEntry cacheEntry = getFromContext(ctx, key);
MVCCEntry mvccEntry;
if (cacheEntry != null && cacheEntry.isNull()) cacheEntry = null;
if (cacheEntry != null) {
mvccEntry = wrapMvccEntryForPut(ctx, key, cacheEntry);
mvccEntry.undelete(undeleteIfNeeded);
} else {
InternalCacheEntry ice = (icEntry == null ? getFromContainer(key) : icEntry);
// A putForExternalRead is putIfAbsent, so if key present, do nothing
if (ice != null && cmd.hasFlag(Flag.PUT_FOR_EXTERNAL_READ)) {
// make sure we record this! Null value since this is a forced lock on the key
ctx.putLookedUpEntry(key, null);
return null;
}
mvccEntry = ice != null ?
wrapInternalCacheEntryForPut(ctx, key, ice) :
newMvccEntryForPut(ctx, key, cmd);
}
mvccEntry.copyForUpdate(container, localModeWriteSkewCheck);
return mvccEntry;
}