/** * Do not modify this class. It was generated. Instead modify LeafRegionEntry.cpp and then run * bin/generateRegionEntryClasses.sh from the directory that contains your build.xml. */ public class VMLocalRowLocationThinDiskRegionEntryOffHeap extends RowLocationThinDiskRegionEntry implements OffHeapRegionEntry { public VMLocalRowLocationThinDiskRegionEntryOffHeap( RegionEntryContext context, Object key, @Retained Object value) { super(context, (value instanceof RecoveredEntry ? null : value)); // DO NOT modify this class. It was generated from LeafRegionEntry.cpp initialize(context, value); this.tableInfo = RegionEntryUtils.entryGetTableInfo(context, key, value); this.key = RegionEntryUtils.entryGetRegionKey(key, value); } // DO NOT modify this class. It was generated from LeafRegionEntry.cpp // common code protected int hash; private HashEntry<Object, Object> next; @SuppressWarnings("unused") private volatile long lastModified; private static final AtomicLongFieldUpdater<VMLocalRowLocationThinDiskRegionEntryOffHeap> lastModifiedUpdater = AtomicUpdaterFactory.newLongFieldUpdater( VMLocalRowLocationThinDiskRegionEntryOffHeap.class, "lastModified"); protected long getlastModifiedField() { return lastModifiedUpdater.get(this); } protected boolean compareAndSetLastModifiedField(long expectedValue, long newValue) { return lastModifiedUpdater.compareAndSet(this, expectedValue, newValue); } /** @see HashEntry#getEntryHash() */ @Override public final int getEntryHash() { return this.hash; } @Override protected void setEntryHash(int v) { this.hash = v; } /** @see HashEntry#getNextEntry() */ @Override public final HashEntry<Object, Object> getNextEntry() { return this.next; } /** @see HashEntry#setNextEntry */ @Override public final void setNextEntry(final HashEntry<Object, Object> n) { this.next = n; } // DO NOT modify this class. It was generated from LeafRegionEntry.cpp // disk code protected void initialize(RegionEntryContext context, Object value) { diskInitialize(context, value); } @Override public int updateAsyncEntrySize(EnableLRU capacityController) { throw new IllegalStateException("should never be called"); } // DO NOT modify this class. It was generated from LeafRegionEntry.cpp private void diskInitialize(RegionEntryContext context, Object value) { DiskRecoveryStore drs = (DiskRecoveryStore) context; DiskStoreImpl ds = drs.getDiskStore(); long maxOplogSize = ds.getMaxOplogSize(); // get appropriate instance of DiskId implementation based on maxOplogSize this.id = DiskId.createDiskId(maxOplogSize, true /* is persistence */, ds.needsLinkedList()); Helper.initialize(this, drs, value); } /** * DiskId * * @since 5.1 */ protected DiskId id; // = new DiskId(); public DiskId getDiskId() { return this.id; } @Override public void setDiskId(RegionEntry old) { this.id = ((AbstractDiskRegionEntry) old).getDiskId(); } // DO NOT modify this class. It was generated from LeafRegionEntry.cpp // key code private Object key; @Override public final Object getRawKey() { return this.key; } @Override protected void _setRawKey(Object key) { this.key = key; } /** * All access done using ohAddrUpdater so it is used even though the compiler can not tell it is. */ @Retained @Released private volatile long ohAddress; /** * I needed to add this because I wanted clear to call setValue which normally can only be called * while the re is synced. But if I sync in that code it causes a lock ordering deadlock with the * disk regions because they also get a rw lock in clear. Some hardware platforms do not support * CAS on a long. If gemfire is run on one of those the AtomicLongFieldUpdater does a sync on the * re and we will once again be deadlocked. I don't know if we support any of the hardware * platforms that do not have a 64bit CAS. If we do then we can expect deadlocks on disk regions. */ private static final AtomicLongFieldUpdater<VMLocalRowLocationThinDiskRegionEntryOffHeap> ohAddrUpdater = AtomicUpdaterFactory.newLongFieldUpdater( VMLocalRowLocationThinDiskRegionEntryOffHeap.class, "ohAddress"); // DO NOT modify this class. It was generated from LeafRegionEntry.cpp @Override public Token getValueAsToken() { return OffHeapRegionEntryHelper.getValueAsToken(this); } @Override @Unretained protected Object getValueField() { return OffHeapRegionEntryHelper._getValue(this); } @Override protected void setValueField(@Unretained Object v) { OffHeapRegionEntryHelper.setValue(this, v); } @Override @Retained public Object _getValueRetain(RegionEntryContext context, boolean decompress) { return OffHeapRegionEntryHelper._getValueRetain(this, decompress); } @Override public long getAddress() { return ohAddrUpdater.get(this); } @Override public boolean setAddress(long expectedAddr, long newAddr) { return ohAddrUpdater.compareAndSet(this, expectedAddr, newAddr); } @Override @Released public void release() { OffHeapRegionEntryHelper.releaseEntry(this); } private transient ExtraTableInfo tableInfo; @Override public final ExtraTableInfo getTableInfo(GemFireContainer baseContainer) { return this.tableInfo; } @Override public final Object getContainerInfo() { return this.tableInfo; } @Override public final Object setContainerInfo(final LocalRegion owner, final Object val) { final GemFireContainer container; ExtraTableInfo tabInfo; if (owner == null) { final RowFormatter rf; if ((tabInfo = this.tableInfo) != null && (rf = tabInfo.getRowFormatter()) != null) { container = rf.container; } else { return null; } } else { container = (GemFireContainer) owner.getUserAttribute(); } if (container != null && container.isByteArrayStore()) { tabInfo = container.getExtraTableInfo(val); this.tableInfo = tabInfo; // cleanup the key if required if (tabInfo != null && tabInfo.regionKeyPartOfValue()) { return tabInfo; } } return null; } @Override public int estimateMemoryUsage() { return ClassSize.refSize; } @Override public int getTypeFormatId() { return StoredFormatIds.ACCESS_MEM_HEAP_ROW_LOCATION_ID; } @Override public final Object cloneObject() { return this; } @Override public final RowLocation getClone() { return this; } @Override public final int compare(DataValueDescriptor other) { // just use some arbitrary criteria like hashCode for ordering if (this == other) { return 0; } return this.hashCode() - other.hashCode(); } @Override public DataValueDescriptor recycle() { return this; } @Override public DataValueDescriptor getNewNull() { return DataValueFactory.DUMMY; } @Override public boolean isNull() { return this == DataValueFactory.DUMMY; } @Override public Object getObject() throws StandardException { return this; } // Unimplemented methods not expected to be invoked @Override public DataValueDescriptor coalesce(DataValueDescriptor[] list, DataValueDescriptor returnValue) throws StandardException { throw new UnsupportedOperationException("unexpected invocation"); } @Override public int compare(DataValueDescriptor other, boolean nullsOrderedLow) throws StandardException { throw new UnsupportedOperationException("unexpected invocation"); } @Override public boolean compare(int op, DataValueDescriptor other, boolean orderedNulls, boolean unknownRV) throws StandardException { throw new UnsupportedOperationException("unexpected invocation"); } @Override public boolean compare( int op, DataValueDescriptor other, boolean orderedNulls, boolean nullsOrderedLow, boolean unknownRV) throws StandardException { throw new UnsupportedOperationException("unexpected invocation"); } @Override public BooleanDataValue equals(DataValueDescriptor left, DataValueDescriptor right) throws StandardException { throw new UnsupportedOperationException("unexpected invocation"); } @Override public int getLengthInBytes(DataTypeDescriptor dtd) throws StandardException { throw new UnsupportedOperationException("unexpected invocation"); } @Override public BooleanDataValue greaterOrEquals(DataValueDescriptor left, DataValueDescriptor right) throws StandardException { throw new UnsupportedOperationException("unexpected invocation"); } @Override public BooleanDataValue greaterThan(DataValueDescriptor left, DataValueDescriptor right) throws StandardException { throw new UnsupportedOperationException("unexpected invocation"); } @Override public BooleanDataValue in( DataValueDescriptor left, DataValueDescriptor[] inList, boolean orderedList) throws StandardException { throw new UnsupportedOperationException("unexpected invocation"); } @Override public BooleanDataValue isNotNull() { throw new UnsupportedOperationException("unexpected invocation"); } @Override public BooleanDataValue isNullOp() { throw new UnsupportedOperationException("unexpected invocation"); } @Override public BooleanDataValue lessOrEquals(DataValueDescriptor left, DataValueDescriptor right) throws StandardException { throw new UnsupportedOperationException("unexpected invocation"); } @Override public BooleanDataValue lessThan(DataValueDescriptor left, DataValueDescriptor right) throws StandardException { throw new UnsupportedOperationException("unexpected invocation"); } @Override public void normalize(DataTypeDescriptor dtd, DataValueDescriptor source) throws StandardException {} @Override public BooleanDataValue notEquals(DataValueDescriptor left, DataValueDescriptor right) throws StandardException { throw new UnsupportedOperationException("unexpected invocation"); } @Override public void readExternalFromArray(ArrayInputStream ais) throws IOException, ClassNotFoundException { throw new UnsupportedOperationException("unexpected invocation"); } @Override public void setValue(DataValueDescriptor theValue) throws StandardException { throw new UnsupportedOperationException("unexpected invocation"); } @Override public int writeBytes(byte[] outBytes, int offset, DataTypeDescriptor dtd) { throw new UnsupportedOperationException("unexpected invocation"); } @Override public int computeHashCode(int maxWidth, int hash) { throw new UnsupportedOperationException("unexpected invocation for " + toString()); } @Override public final DataValueDescriptor getKeyColumn(int index) { throw new UnsupportedOperationException("unexpected invocation"); } @Override public final void getKeyColumns(DataValueDescriptor[] keys) { throw new UnsupportedOperationException("unexpected invocation"); } @Override public boolean compare( int op, ExecRow row, boolean byteArrayStore, int colIdx, boolean orderedNulls, boolean unknownRV) throws StandardException { throw new UnsupportedOperationException("unexpected invocation"); } @Override public boolean compare( int op, CompactCompositeKey key, int colIdx, boolean orderedNulls, boolean unknownRV) throws StandardException { throw new UnsupportedOperationException("unexpected invocation"); } @Override public int equals( RowFormatter rf, byte[] bytes, boolean isKeyBytes, int logicalPosition, int keyBytesPos, final DataValueDescriptor[] outDVD) throws StandardException { throw new UnsupportedOperationException("unexpected invocation"); } @Override public byte getTypeId() { throw new UnsupportedOperationException("Implement the method for DataType=" + this); } @Override public void writeNullDVD(DataOutput out) throws IOException { throw new UnsupportedOperationException("Implement the method for DataType=" + this); } @Override public Object getValueWithoutFaultInOrOffHeapEntry(LocalRegion owner) { return this; } @Override public Object getValueOrOffHeapEntry(LocalRegion owner) { return this; } @Override public Object getRawValue() { Object val = OffHeapRegionEntryHelper._getValueRetain(this, false); if (val != null && !Token.isInvalidOrRemoved(val) && val != Token.NOT_AVAILABLE) { CachedDeserializable storedObject = (CachedDeserializable) val; return storedObject.getDeserializedValue(null, this); } return null; } @Override public Object prepareValueForCache( RegionEntryContext r, Object val, boolean isEntryUpdate, boolean valHasMetadataForGfxdOffHeapUpdate) { if (okToStoreOffHeap(val) && OffHeapRegionEntryUtils.isValidValueForGfxdOffHeapStorage(val)) { // TODO:Asif:Check if this is a valid supposition // final long address = this.getAddress(); if (isEntryUpdate /* * (address == OffHeapRegionEntryHelper.REMOVED_PHASE1_ADDRESS || address * == OffHeapRegionEntryHelper.NULL_ADDRESS) || r instanceof * PlaceHolderDiskRegion */ ) { return OffHeapRegionEntryUtils.prepareValueForUpdate( this, r, val, valHasMetadataForGfxdOffHeapUpdate); } else { return OffHeapRegionEntryUtils.prepareValueForCreate(r, val, false); } } return super.prepareValueForCache(r, val, isEntryUpdate, valHasMetadataForGfxdOffHeapUpdate); } @Override public boolean destroy( LocalRegion region, EntryEventImpl event, boolean inTokenMode, boolean cacheWrite, @Unretained Object expectedOldValue, boolean forceDestroy, boolean removeRecoveredEntry) throws CacheWriterException, EntryNotFoundException, TimeoutException, RegionClearedException { Object key = event.getKey(); if (key instanceof CompactCompositeRegionKey) { byte[] keyBytes = ((CompactCompositeRegionKey) key).snapshotKeyFromValue(false); if (keyBytes != null) { this._setRawKey(keyBytes); } } return super.destroy( region, event, inTokenMode, cacheWrite, expectedOldValue, forceDestroy, removeRecoveredEntry); } @Override public Version[] getSerializationVersions() { return null; } @Override public Object getValue(GemFireContainer baseContainer) { return RegionEntryUtils.getValue(baseContainer.getRegion(), this); } @Override public Object getValueWithoutFaultIn(GemFireContainer baseContainer) { return RegionEntryUtils.getValueWithoutFaultIn(baseContainer.getRegion(), this); } @Override public ExecRow getRow(GemFireContainer baseContainer) { return RegionEntryUtils.getRow(baseContainer, baseContainer.getRegion(), this, this.tableInfo); } @Override public ExecRow getRowWithoutFaultIn(GemFireContainer baseContainer) { return RegionEntryUtils.getRowWithoutFaultIn( baseContainer, baseContainer.getRegion(), this, this.tableInfo); } @Override public int getBucketID() { return -1; } @Override protected StringBuilder appendFieldsToString(final StringBuilder sb) { sb.append("key="); // OFFHEAP _getValue ok: the current toString on OffHeapCachedDeserializable // is safe to use without incing refcount. final Object k = getKeyCopy(); final Object val = OffHeapRegionEntryUtils.getHeapRowForInVMValue(this); RegionEntryUtils.entryKeyString(k, val, getTableInfo(null), sb); sb.append("; byte source = " + this._getValue()); sb.append("; rawValue="); ArrayUtils.objectStringNonRecursive(val, sb); sb.append("; lockState=0x").append(Integer.toHexString(getState())); return sb; } // DO NOT modify this class. It was generated from LeafRegionEntry.cpp private static RegionEntryFactory factory = new RegionEntryFactory() { public final RegionEntry createEntry(RegionEntryContext context, Object key, Object value) { return new VMLocalRowLocationThinDiskRegionEntryOffHeap(context, key, value); } public final Class<?> getEntryClass() { return VMLocalRowLocationThinDiskRegionEntryOffHeap.class; } public RegionEntryFactory makeVersioned() { return VersionedLocalRowLocationThinDiskRegionEntryOffHeap.getEntryFactory(); } @Override public RegionEntryFactory makeOnHeap() { return VMLocalRowLocationThinDiskRegionEntryHeap.getEntryFactory(); } }; public static RegionEntryFactory getEntryFactory() { return factory; } // DO NOT modify this class. It was generated from LeafRegionEntry.cpp }
/** * Do not modify this class. It was generated. Instead modify LeafRegionEntry.cpp and then run * bin/generateRegionEntryClasses.sh from the directory that contains your build.xml. */ @SuppressWarnings("serial") public class VersionedThinRegionEntryOffHeap extends VMThinRegionEntry implements OffHeapRegionEntry, VersionStamp { public VersionedThinRegionEntryOffHeap( RegionEntryContext context, Object key, @Retained Object value) { super(context, value); // DO NOT modify this class. It was generated from LeafRegionEntry.cpp this.key = key; } // DO NOT modify this class. It was generated from LeafRegionEntry.cpp // common code protected int hash; private HashEntry<Object, Object> next; @SuppressWarnings("unused") private volatile long lastModified; private static final AtomicLongFieldUpdater<VersionedThinRegionEntryOffHeap> lastModifiedUpdater = AtomicUpdaterFactory.newLongFieldUpdater( VersionedThinRegionEntryOffHeap.class, "lastModified"); protected long getlastModifiedField() { return lastModifiedUpdater.get(this); } protected boolean compareAndSetLastModifiedField(long expectedValue, long newValue) { return lastModifiedUpdater.compareAndSet(this, expectedValue, newValue); } /** @see HashEntry#getEntryHash() */ @Override public final int getEntryHash() { return this.hash; } @Override protected void setEntryHash(int v) { this.hash = v; } /** @see HashEntry#getNextEntry() */ @Override public final HashEntry<Object, Object> getNextEntry() { return this.next; } /** @see HashEntry#setNextEntry */ @Override public final void setNextEntry(final HashEntry<Object, Object> n) { this.next = n; } // DO NOT modify this class. It was generated from LeafRegionEntry.cpp // versioned code private VersionSource memberID; private short entryVersionLowBytes; private short regionVersionHighBytes; private int regionVersionLowBytes; private byte entryVersionHighByte; private byte distributedSystemId; public int getEntryVersion() { return ((entryVersionHighByte << 16) & 0xFF0000) | (entryVersionLowBytes & 0xFFFF); } public long getRegionVersion() { return (((long) regionVersionHighBytes) << 32) | (regionVersionLowBytes & 0x00000000FFFFFFFFL); } public long getVersionTimeStamp() { return getLastModified(); } public void setVersionTimeStamp(long time) { setLastModified(time); } public VersionSource getMemberID() { return this.memberID; } public int getDistributedSystemId() { return this.distributedSystemId; } // DO NOT modify this class. It was generated from LeafRegionEntry.cpp public void setVersions(VersionTag tag) { this.memberID = tag.getMemberID(); int eVersion = tag.getEntryVersion(); this.entryVersionLowBytes = (short) (eVersion & 0xffff); this.entryVersionHighByte = (byte) ((eVersion & 0xff0000) >> 16); this.regionVersionHighBytes = tag.getRegionVersionHighBytes(); this.regionVersionLowBytes = tag.getRegionVersionLowBytes(); if (!(tag.isGatewayTag()) && this.distributedSystemId == tag.getDistributedSystemId()) { if (getVersionTimeStamp() <= tag.getVersionTimeStamp()) { setVersionTimeStamp(tag.getVersionTimeStamp()); } else { tag.setVersionTimeStamp(getVersionTimeStamp()); } } else { setVersionTimeStamp(tag.getVersionTimeStamp()); } this.distributedSystemId = (byte) (tag.getDistributedSystemId() & 0xff); } public void setMemberID(VersionSource memberID) { this.memberID = memberID; } @Override public VersionStamp getVersionStamp() { return this; } // DO NOT modify this class. It was generated from LeafRegionEntry.cpp public VersionTag asVersionTag() { VersionTag tag = VersionTag.create(memberID); tag.setEntryVersion(getEntryVersion()); tag.setRegionVersion(this.regionVersionHighBytes, this.regionVersionLowBytes); tag.setVersionTimeStamp(getVersionTimeStamp()); tag.setDistributedSystemId(this.distributedSystemId); return tag; } public void processVersionTag( LocalRegion r, VersionTag tag, boolean isTombstoneFromGII, boolean hasDelta, VersionSource thisVM, InternalDistributedMember sender, boolean checkForConflicts) { basicProcessVersionTag(r, tag, isTombstoneFromGII, hasDelta, thisVM, sender, checkForConflicts); } @Override public void processVersionTag(EntryEvent cacheEvent) { // this keeps Eclipse happy. without it the sender chain becomes confused // while browsing this code super.processVersionTag(cacheEvent); } /** get rvv internal high byte. Used by region entries for transferring to storage */ public short getRegionVersionHighBytes() { return this.regionVersionHighBytes; } /** get rvv internal low bytes. Used by region entries for transferring to storage */ public int getRegionVersionLowBytes() { return this.regionVersionLowBytes; } // DO NOT modify this class. It was generated from LeafRegionEntry.cpp // key code private Object key; @Override public final Object getRawKey() { return this.key; } @Override protected void _setRawKey(Object key) { this.key = key; } /** * All access done using ohAddrUpdater so it is used even though the compiler can not tell it is. */ @Retained @Released private volatile long ohAddress; /** * I needed to add this because I wanted clear to call setValue which normally can only be called * while the re is synced. But if I sync in that code it causes a lock ordering deadlock with the * disk regions because they also get a rw lock in clear. Some hardware platforms do not support * CAS on a long. If gemfire is run on one of those the AtomicLongFieldUpdater does a sync on the * re and we will once again be deadlocked. I don't know if we support any of the hardware * platforms that do not have a 64bit CAS. If we do then we can expect deadlocks on disk regions. */ private static final AtomicLongFieldUpdater<VersionedThinRegionEntryOffHeap> ohAddrUpdater = AtomicUpdaterFactory.newLongFieldUpdater(VersionedThinRegionEntryOffHeap.class, "ohAddress"); // DO NOT modify this class. It was generated from LeafRegionEntry.cpp @Override public Token getValueAsToken() { return OffHeapRegionEntryHelper.getValueAsToken(this); } @Override @Unretained protected Object getValueField() { return OffHeapRegionEntryHelper._getValue(this); } @Override protected void setValueField(@Unretained Object v) { OffHeapRegionEntryHelper.setValue(this, v); } @Override @Retained public Object _getValueRetain(RegionEntryContext context, boolean decompress) { return OffHeapRegionEntryHelper._getValueRetain(this, decompress); } @Override public long getAddress() { return ohAddrUpdater.get(this); } @Override public boolean setAddress(long expectedAddr, long newAddr) { return ohAddrUpdater.compareAndSet(this, expectedAddr, newAddr); } @Override @Released public void release() { OffHeapRegionEntryHelper.releaseEntry(this); } // DO NOT modify this class. It was generated from LeafRegionEntry.cpp private static RegionEntryFactory factory = new RegionEntryFactory() { public final RegionEntry createEntry(RegionEntryContext context, Object key, Object value) { return new VersionedThinRegionEntryOffHeap(context, key, value); } public final Class<?> getEntryClass() { return VersionedThinRegionEntryOffHeap.class; } public RegionEntryFactory makeVersioned() { return this; } @Override public RegionEntryFactory makeOnHeap() { return VersionedThinRegionEntryHeap.getEntryFactory(); } }; public static RegionEntryFactory getEntryFactory() { return factory; } // DO NOT modify this class. It was generated from LeafRegionEntry.cpp }