private static RowLocation extractRowLocationFromEntry( final Region.Entry<?, ?> entry) { if (entry != null) { final Class<?> cls = entry.getClass(); if (cls == LocalRegion.NonTXEntry.class) { return (RowLocation)((LocalRegion.NonTXEntry)entry).getRegionEntry(); } else if (cls == TXEntry.class) { return (GfxdTXEntryState)((TXEntry)entry).getTXEntryState(); } else { return (RowLocation)((EntrySnapshot)entry).getRegionEntry(); } } else { return null; } } }
@Override public Get70.Entry getValueAndIsObject(Region region, Object key, Object callbackArg, ServerConnection servConn) { LocalRegion lregion = (LocalRegion)region; Object data = null; Region.Entry entry = region.getEntry(key); if (logger.isDebugEnabled()) { logger.debug("GetEntryCommand: for key: {} returning entry: {}", key, entry); } VersionTag tag = null; if (entry != null) { EntrySnapshot snap = new EntrySnapshot(); NonLocalRegionEntry re = new NonLocalRegionEntry(entry, lregion); snap.setRegionEntry(re); snap.setRegion(lregion); data = snap; tag = snap.getVersionTag(); } Get70.Entry result = new Get70.Entry(); result.value = data; result.isObject = true; result.keyNotPresent = false; result.versionTag = tag; return result; } }
public Region getRegion() { checkEntryDestroyed(); return region; }
public Object getValue() { checkEntryDestroyed(); return getRawValue(); }
@Override public String toString() { if (this.isDestroyed()) { return "EntrySnapshot(#destroyed#" + regionEntry.getKey() + "; version=" + this.getVersionTag() + ")"; } else { return "EntrySnapshot(" + this.regionEntry + ")"; } }
@Override public void getValueAndIsObject(Region p_region, Object key, Object callbackArg, ServerConnection servConn, Object[] result) { Object data = null; LocalRegion region = (LocalRegion) p_region; Entry entry = region.getEntry(key); if (logger.isDebugEnabled()) { logger.debug("GetEntryCommand: for key: {} returning entry: {}", key, entry); } if (entry != null) { EntrySnapshot snap = new EntrySnapshot(); NonLocalRegionEntry re = new NonLocalRegionEntry(entry, region); snap.setRegionEntry(re); snap.setRegion(region); data = snap; } result[0] = data; result[1] = true; // isObject is true } }
Object value = null; if (entry instanceof EntrySnapshot) { vt = ((EntrySnapshot) entry).getVersionTag(); key = ((EntrySnapshot) entry).getRegionEntry().getKey(); value = ((EntrySnapshot) entry).getRegionEntry().getValue(null); updateValues(values, key, value, vt); } else {
public final Object readEntry(final ExclusiveSharedLockObject lockObj, final Object context, int iContext, boolean allowTombstones) { final RegionEntry re = (RegionEntry)lockObj; if ((re.isTombstone() && allowTombstones) || !re.isDestroyedOrRemoved()) { return new EntrySnapshot(re, (LocalRegion)context, partitionedRegion, allowTombstones); } return null; } };
@Override public boolean equals(Object obj) { if (!(obj instanceof EntrySnapshot)) { return false; } EntrySnapshot ent = (EntrySnapshot)obj; return this.regionEntry.getKey().equals(ent.getKey()); }
/** * Test hook - returns the version stamp for an entry in the form of a * version tag * @param key * @return the entry version information */ public VersionTag getVersionTag(Object key) { Region.Entry entry = getEntry(key, true); VersionTag tag = null; if (entry != null && entry instanceof EntrySnapshot) { tag = ((EntrySnapshot)entry).getVersionTag(); } else if (entry != null && entry instanceof NonTXEntry) { tag = ((NonTXEntry)entry).getRegionEntry().getVersionStamp().asVersionTag(); } return tag; }
private void checkEntryDestroyed() throws EntryDestroyedException { if (isDestroyed()) { throw new EntryDestroyedException(LocalizedStrings.PartitionedRegion_ENTRY_DESTROYED.toLocalizedString()); } }
public EntrySnapshot(DataInput in,LocalRegion region) throws IOException, ClassNotFoundException { this.fromData(in); this.region = region; }
public Object getRawValue() { Object v = this.regionEntry.getValue(null); if (v == null) { return null; } if (v instanceof CachedDeserializable) { if (region.isCopyOnRead()) { v = ((CachedDeserializable)v).getDeserializedWritableCopy(null, null); } else { v = ((CachedDeserializable)v).getDeserializedValue(null, null); } if (v == Token.INVALID || v == Token.LOCAL_INVALID) { v = null; } } else { if (v == Token.INVALID || v == Token.LOCAL_INVALID) { v = null; } else { v = conditionalCopy(v); } } return v; }
this.prStats.incPartitionMessagesSent(); EntrySnapshot entry = r.waitForResponse(); if (entry != null && entry.getRawValue() == Token.TOMBSTONE){ if (!allowTombstones) { return null;
@Override public void fromData(DataInput in) throws IOException, ClassNotFoundException { super.fromData(in); boolean nullEntry = in.readBoolean(); if (!nullEntry) { // since the Entry object shares state with the PartitionedRegion, // we have to find the region and ask it to create a new Entry instance // to be populated from the DataInput FetchEntryResponse processor = (FetchEntryResponse)ReplyProcessor21 .getProcessor(this.processorId); if (processor == null) { throw new OperationCancelledException("This operation was cancelled (null processor)"); } this.value = new EntrySnapshot(in,processor.partitionedRegion); } }
@Override public String toString() { if (this.isDestroyed()) { return "EntrySnapshot(#destroyed#" + regionEntry.getKeyCopy() + "; version=" + this.getVersionTag() + ")"; } else { return "EntrySnapshot(key=" + regionEntry.getKeyCopy() + ";valueInVM=" + this.regionEntry.getValueInVM(null) + ')'; } }
public Object getValue() { checkEntryDestroyed(); return getRawValue(); }
@Override public boolean equals(Object obj) { if (!(obj instanceof EntrySnapshot)) { return false; } EntrySnapshot ent = (EntrySnapshot)obj; return this.regionEntry.getKey().equals(ent.getKey()); }
/** * 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(Region.Entry re, LocalRegion br) { this.key = re.getKey(); this.value = re.getValue(); if (this.value instanceof CachedDeserializable) { // We make a copy of the CachedDeserializable. // That way the NonLocalRegionEntry will be disconnected // from the CachedDeserializable that is in our cache and // will not modify its state. this.value = CachedDeserializableFactory.create((CachedDeserializable)this.value); } Assert.assertTrue(this.value != Token.NOT_AVAILABLE, "getEntry did not fault value in from disk"); this.lastModified = 0l;//re.getStatistics().getLastModifiedTime(); this.isRemoved = Token.isRemoved(value); if (re instanceof EntrySnapshot) { this.versionTag = ((EntrySnapshot)re).getVersionTag(); } else { // TODO need to get version information from transaction entries } }
private void checkEntryDestroyed() throws EntryDestroyedException { if (isDestroyed()) { throw new EntryDestroyedException(LocalizedStrings.PartitionedRegion_ENTRY_DESTROYED.toLocalizedString()); } }