private final Object getSerialized(final RegionEntry re, final boolean doNotLockEntry) { // TODO OFFHEAP: todo v ends up in a RawValue. For now this can be a copy of // the offheap onto the heap. But it might be easy to track lifetime of // RawValue Object v = re.getValue(this); if (doNotLockEntry) { if (v == Token.NOT_AVAILABLE || v == null) { return RawValue.REQUIRES_ENTRY_LOCK; } } return v; }
/** * @return possible OFF_HEAP_OBJECT (caller must release) */ @Retained public static Object convertOffHeapEntrytoByteSourceRetain( RegionEntry offheap, LocalRegion rgn, boolean faultIn, boolean useValueInVMOnly) { @Retained Object obj = null; if (useValueInVMOnly) { obj = offheap.getValueInVM(null); } else { if (faultIn) { obj = offheap.getValue(rgn); } else { obj = offheap.getValueOffHeapOrDiskWithoutFaultIn(rgn); } } if (!isValueToken(obj)) { if (!(obj instanceof DataAsAddress)) { return obj; } else { return encodedAddressToObject(((DataAsAddress)obj).getEncodedAddress()); } } return null; }
public final Object readEntry(final ExclusiveSharedLockObject lockObj, Object context, int iContext, boolean allowTombstones) { return ((RegionEntry)lockObj).getValue((LocalRegion)context); } };
protected Object readEntryValue() { return this.entry.getValue(this.region); }
/** Package helper method */ @Retained final Object getEntryValue(RegionEntry entry) { if (entry == null) { return null; } try { return entry.getValue(this); } catch (DiskAccessException dae) { this.handleDiskAccessException(dae, true/* stop bridge servers*/); throw dae; } }
/** * Returns either a byte[] or byte[][] or OffHeapByteSource depending upon the type of entry & data * @param region * @param entry * @return */ public static Object getValue(final LocalRegion region, final RegionEntry entry) { final Object value = entry.getValue(getDataRegion(region, entry)); if (!isValueToken(value)) { return value; } return null; }
/** * Returns either a byte[] or byte[][] or OffHeapByteSource depending upon the type of entry & data * @param region * @param entry * @return */ public static Object getValue(final LocalRegion region, final RegionEntry entry) { final Object value = entry.getValue(getDataRegion(region, entry)); if (!isValueToken(value)) { return value; } return null; }
/** * Returns either a byte[] or byte[][] or OffHeapByteSource depending upon the type of entry & data * @param region * @param entry * @return */ public static Object getValue(final LocalRegion region, final RegionEntry entry) { final Object value = entry.getValue(getDataRegion(region, entry)); if (!isValueToken(value)) { return value; } return null; }
/** Package helper method */ @Retained Object getEntryValue(RegionEntry entry) { if (entry == null) { return null; } try { return entry.getValue(this); }catch(DiskAccessException dae) { this.handleDiskAccessException(dae); throw dae; } }
@Override public Object getTargetObject(RegionEntry entry) { if (indexOnValues) { Object o = entry.getValue((LocalRegion) region); if (o instanceof CachedDeserializable) { return ((CachedDeserializable) o).getDeserializedValue( region, entry); } return o; } else if (indexOnRegionKeys) { return entry.getKey(); } return ((LocalRegion) region).new NonTXEntry(entry); }
/** * Test Method: Fetch a value from the local cache * * @param key * The kye * @return the value associated with that key * @see LocalRegion#get(Object, Object, boolean, EntryEventImpl) */ public Object localCacheGet(Object key) { RegionEntry re = getRegionMap().getEntry(key); if (re == null || re.isDestroyedOrRemoved()) { // TODO:KIRK:OK if (re == null || Token.isRemoved(re.getValueInVM(this))) { return null; } else { return re.getValue(this); // OFFHEAP: spin until we can copy into a heap cd? } }
/** * Test Method: Fetch a value from the local cache * * @param key * The kye * @return the value associated with that key * @see LocalRegion#get(Object, Object, boolean, EntryEventImpl) */ public Object localCacheGet(Object key) { RegionEntry re = getRegionMap().getEntry(key); if (re == null || re.isDestroyedOrRemoved()) { // TODO:KIRK:OK if (re == null || Token.isRemoved(re.getValueInVM(this))) { return null; } else { return re.getValue(this); // OFFHEAP: spin until we can copy into a heap cd? } }
public Object getTargetObjectForUpdate(RegionEntry entry) { if (indexOnValues) { Object o = entry.getValue((LocalRegion)this.region); try { if (o == Token.INVALID) { return Token.INVALID; } if (o instanceof CachedDeserializable) { return ((CachedDeserializable) o).getDeserializedValue( this.region, entry); } } catch (EntryDestroyedException ede) { return Token.INVALID; } return o; } else if (indexOnRegionKeys) { return entry.getKey(); } return ((LocalRegion) this.region).new NonTXEntry(entry); }
/** * Get the object of interest from the region entry. For now it always gets * the deserialized value. */ public Object getTargetObject(RegionEntry entry) { if (indexOnValues) { Object o = entry.getValue((LocalRegion) MemoryIndexStore.this.region); try { if (o == Token.INVALID) { return null; } if (o instanceof CachedDeserializable) { return ((CachedDeserializable) o).getDeserializedValue( MemoryIndexStore.this.region, entry); } } catch (EntryDestroyedException ede) { return null; } return o; } else if (indexOnRegionKeys) { return entry.getKey(); } return ((LocalRegion) MemoryIndexStore.this.region).new NonTXEntry(entry); }
/** * To get the value from region in serialized form * @return {@link VMCachedDeserializable} */ public Object getRawValue() { Object value = this.basicGetEntry().getValue((LocalRegion) getRegion()); if (value == null) { throw new EntryDestroyedException(this.getRegionEntry().getKey().toString()); } else if(Token.isInvalid(value)) { return null; } return value; }
/** * To get the value from region in serialized form * @return {@link VMCachedDeserializable} */ public Object getRawValue() { if (this.regionVal != null) { return this.regionVal; } Object value = this.basicGetEntry().getValue((LocalRegion) getRegion()); if (value == null) { throw new EntryDestroyedException(this.getRegionEntry().getKeyCopy() .toString()); } else if(Token.isInvalid(value)) { return null; } return value; }
/** * Get the object of interest from the region entry. For now it always gets * the deserialized value. */ private Object getTargetObject(RegionEntry entry) { if (this.indexOnValues) { Object o = entry.getValue((LocalRegion) getRegion()); // OFFHEAP: incrc, deserialize, decrc try { if (o == Token.INVALID) { return null; } if (o instanceof CachedDeserializable) { return ((CachedDeserializable) o).getDeserializedForReading(); } } catch (EntryDestroyedException ede) { return null; } return o; } else if (this.indexOnRegionKeys) { return entry.getKey(); } return ((LocalRegion) getRegion()).new NonTXEntry(entry); }
/** * Get the object of interest from the region entry. For now it always gets * the deserialized value. */ @Override public Object getTargetObject(RegionEntry entry) { if (indexOnValues) { Object o = entry.getValue((LocalRegion)this.region); try { if (o == Token.INVALID) { return null; } if (o instanceof CachedDeserializable) { return ((CachedDeserializable) o).getDeserializedValue( this.region, entry); } } catch (EntryDestroyedException ede) { return null; } return o; } else if (indexOnRegionKeys) { return entry.getKey(); } return new CachedEntryWrapper(((LocalRegion) this.region).new NonTXEntry(entry)); }
/** * Create one of these in the local case so that we have a snapshot of the state * and can allow the bucket to move out from under us. */ public NonLocalRegionEntry(RegionEntry re, LocalRegion br, boolean allowTombstones) { this.key = re.getKey(); if (allowTombstones && re.isTombstone()) { // client get() operations need to see tombstone values this.value = Token.TOMBSTONE; } else { this.value = re.getValue(br); // OFFHEAP: copy into heap cd } Assert.assertTrue(this.value != Token.NOT_AVAILABLE, "getEntry did not fault value in from disk"); this.lastModified = re.getLastModified(); this.isRemoved = re.isRemoved(); VersionStamp stamp = re.getVersionStamp(); if (stamp != null) { this.versionTag = stamp.asVersionTag(); } }
/** * Create one of these in the local case so that we have a snapshot of the * state and can allow the bucket to move out from under us. */ protected NonLocalRegionEntry(RegionEntry re, LocalRegion br, boolean allowTombstones) { this.key = re.getKeyCopy(); // client get() operations need to see tombstone values if (allowTombstones && re.isTombstone()) { this.value = Token.TOMBSTONE; } else { this.value = re.getValue(br); // OFFHEAP: copy into heap cd } Assert.assertTrue(this.value != Token.NOT_AVAILABLE, "getEntry did not fault value in from disk"); this.lastModified = re.getLastModified(); this.isRemoved = re.isRemoved(); VersionStamp<?> stamp = re.getVersionStamp(); if (stamp != null) { this.versionTag = stamp.asVersionTag(); } }