@Retained public final Object getValueInVM(RegionEntryContext context) { ReferenceCountHelper.createReferenceCountOwner(); @Retained Object v = _getValueRetain(context, true); if (v == null) { // should only be possible if disk entry v = Token.NOT_AVAILABLE; } @Retained Object result = OffHeapHelper.copyAndReleaseIfNeeded(v); // TODO OFFHEAP keep it offheap? ReferenceCountHelper.setReferenceCountOwner(null); return result; }
@Override public Object getValue(RegionEntryContext context) { ReferenceCountHelper.createReferenceCountOwner(); @Retained Object result = _getValueRetain(context, true); //Asif: If the thread is an Index Creation Thread & the value obtained is //Token.REMOVED , we can skip synchronization block. This is required to prevent // the dead lock caused if an Index Update Thread has gone into a wait holding the // lock of the Entry object. There should not be an issue if the Index creation thread // gets the temporary value of token.REMOVED as the correct value will get indexed // by the Index Update Thread , once the index creation thread has exited. // Part of Bugfix # 33336 // if ((result == Token.REMOVED_PHASE1 || result == Token.REMOVED_PHASE2) && !r.isIndexCreationThread()) { // synchronized (this) { // result = _getValue(); // } // } if (Token.isRemoved(result)) { ReferenceCountHelper.setReferenceCountOwner(null); return null; } else { result = OffHeapHelper.copyAndReleaseIfNeeded(result); // sqlf does not dec ref count in this call ReferenceCountHelper.setReferenceCountOwner(null); setRecentlyUsed(); return result; } }