예제 #1
0
 @Override
 public final MVCCEntry wrapEntryForRemove(InvocationContext ctx, Object key)
     throws InterruptedException {
   CacheEntry cacheEntry = getFromContext(ctx, key);
   MVCCEntry mvccEntry = null;
   if (cacheEntry != null) {
     if (cacheEntry instanceof MVCCEntry && !(cacheEntry instanceof NullMarkerEntry)) {
       mvccEntry = (MVCCEntry) cacheEntry;
     } else {
       mvccEntry = wrapMvccEntryForRemove(ctx, key, cacheEntry);
     }
   } else {
     InternalCacheEntry ice = getFromContainer(key);
     if (ice != null) {
       mvccEntry = wrapInternalCacheEntryForPut(ctx, key, ice);
     }
   }
   if (mvccEntry == null) {
     // make sure we record this! Null value since this is a forced lock on the key
     ctx.putLookedUpEntry(key, null);
   } else {
     mvccEntry.copyForUpdate(container, localModeWriteSkewCheck);
   }
   return mvccEntry;
 }
예제 #2
0
 private MVCCEntry wrapEntry(InvocationContext ctx, Object key) {
   CacheEntry cacheEntry = getFromContext(ctx, key);
   MVCCEntry mvccEntry = null;
   if (cacheEntry != null) {
     mvccEntry = wrapMvccEntryForPut(ctx, key, cacheEntry);
   } else {
     InternalCacheEntry ice = getFromContainer(key);
     if (ice != null) {
       mvccEntry = wrapInternalCacheEntryForPut(ctx, ice.getKey(), ice);
     }
   }
   if (mvccEntry != null) mvccEntry.copyForUpdate(container, localModeWriteSkewCheck);
   return mvccEntry;
 }
예제 #3
0
  @Override
  public final MVCCEntry wrapEntryForPut(
      InvocationContext ctx, Object key, InternalCacheEntry icEntry, boolean undeleteIfNeeded)
      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 && ctx.hasFlag(Flag.PUT_FOR_EXTERNAL_READ)) return null;

      mvccEntry =
          ice != null ? wrapInternalCacheEntryForPut(ctx, key, ice) : newMvccEntryForPut(ctx, key);
    }
    mvccEntry.copyForUpdate(container, localModeWriteSkewCheck);
    return mvccEntry;
  }