http://git-wip-us.apache.org/repos/asf/geode/blob/a4458531/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryHeapStringKey2.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryHeapStringKey2.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryHeapStringKey2.java index dec4f9f..154825a 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryHeapStringKey2.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryHeapStringKey2.java @@ -15,25 +15,36 @@ package org.apache.geode.internal.cache; // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + + + import java.util.concurrent.atomic.AtomicIntegerFieldUpdater; + import java.util.concurrent.atomic.AtomicLongFieldUpdater; + import org.apache.geode.cache.EntryEvent; + import org.apache.geode.internal.cache.lru.EnableLRU; + import org.apache.geode.internal.cache.persistence.DiskRecoveryStore; + import org.apache.geode.internal.InternalStatisticsDisabledException; + import org.apache.geode.internal.cache.lru.LRUClockNode; import org.apache.geode.internal.cache.lru.NewLRUClockHand; + import org.apache.geode.distributed.internal.membership.InternalDistributedMember; import org.apache.geode.internal.cache.versions.VersionSource; import org.apache.geode.internal.cache.versions.VersionStamp; import org.apache.geode.internal.cache.versions.VersionTag; + import org.apache.geode.internal.util.concurrent.CustomEntryConcurrentHashMap.HashEntry; // macros whose definition changes this class: -// disk: DISK -// lru: LRU -// stats: STATS -// versioned: VERSIONED +// disk: 1 +// lru: 1 +// stats: 1 +// versioned: 1 // offheap: OFFHEAP // One of the following key macros must be defined: // key object: KEY_OBJECT @@ -41,7 +52,8 @@ import org.apache.geode.internal.util.concurrent.CustomEntryConcurrentHashMap.Ha // key long: KEY_LONG // key uuid: KEY_UUID // key string1: KEY_STRING1 -// key string2: KEY_STRING2 +// key string2: 1 + /** * Do not modify this class. It was generated. Instead modify LeafRegionEntry.cpp and then run * ./dev-tools/generateRegionEntryClasses.sh (it must be run from the top level directory). @@ -49,10 +61,25 @@ import org.apache.geode.internal.util.concurrent.CustomEntryConcurrentHashMap.Ha public class VersionedStatsDiskLRURegionEntryHeapStringKey2 extends VersionedStatsDiskLRURegionEntryHeap { public VersionedStatsDiskLRURegionEntryHeapStringKey2(RegionEntryContext context, String key, - Object value, boolean byteEncode) { - super(context, (value instanceof RecoveredEntry ? null : value)); + + + + Object value + + , boolean byteEncode + + ) { + super(context, + + (value instanceof RecoveredEntry ? null : value) + + + + ); // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + initialize(context, value); + // caller has already confirmed that key.length <= MAX_INLINE_STRING_KEY long tmpBits1 = 0L; long tmpBits2 = 0L; @@ -83,9 +110,11 @@ public class VersionedStatsDiskLRURegionEntryHeapStringKey2 tmpBits1 |= key.length(); this.bits1 = tmpBits1; this.bits2 = tmpBits2; + } // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + // common code protected int hash; private HashEntry<Object, Object> next; @@ -94,10 +123,11 @@ public class VersionedStatsDiskLRURegionEntryHeapStringKey2 private static final AtomicLongFieldUpdater<VersionedStatsDiskLRURegionEntryHeapStringKey2> lastModifiedUpdater = AtomicLongFieldUpdater.newUpdater(VersionedStatsDiskLRURegionEntryHeapStringKey2.class, "lastModified"); + private volatile Object value; @Override - protected final Object getValueField() { + protected Object getValueField() { return this.value; } @@ -117,7 +147,7 @@ public class VersionedStatsDiskLRURegionEntryHeapStringKey2 /** * @see HashEntry#getEntryHash() */ - public final int getEntryHash() { + public int getEntryHash() { return this.hash; } @@ -128,19 +158,22 @@ public class VersionedStatsDiskLRURegionEntryHeapStringKey2 /** * @see HashEntry#getNextEntry() */ - public final HashEntry<Object, Object> getNextEntry() { + public HashEntry<Object, Object> getNextEntry() { return this.next; } /** * @see HashEntry#setNextEntry */ - public final void setNextEntry(final HashEntry<Object, Object> n) { + public 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 drs, Object value) { boolean isBackup; if (drs instanceof LocalRegion) { @@ -157,7 +190,7 @@ public class VersionedStatsDiskLRURegionEntryHeapStringKey2 } @Override - public final synchronized int updateAsyncEntrySize(EnableLRU capacityController) { + public synchronized int updateAsyncEntrySize(EnableLRU capacityController) { int oldSize = getEntrySize(); int newSize = capacityController.entrySize(getKeyForSizing(), null); setEntrySize(newSize); @@ -165,7 +198,9 @@ public class VersionedStatsDiskLRURegionEntryHeapStringKey2 return delta; } + // 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(); @@ -190,7 +225,6 @@ public class VersionedStatsDiskLRURegionEntryHeapStringKey2 void setDiskId(RegionEntry old) { this.id = ((AbstractDiskRegionEntry) old).getDiskId(); } - // // inlining DiskId // // always have these fields // /** @@ -230,108 +264,113 @@ public class VersionedStatsDiskLRURegionEntryHeapStringKey2 // // persistent // /** unique entry identifier * */ // private long keyId; + + + // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + // lru code @Override public void setDelayedDiskId(LocalRegion r) { + DiskStoreImpl ds = r.getDiskStore(); long maxOplogSize = ds.getMaxOplogSize(); this.id = DiskId.createDiskId(maxOplogSize, false /* over flow only */, ds.needsLinkedList()); + + + } - public final synchronized int updateEntrySize(EnableLRU capacityController) { + public synchronized int updateEntrySize(EnableLRU capacityController) { return updateEntrySize(capacityController, _getValue()); // OFHEAP: _getValue ok w/o incing // refcount because we are synced and // only getting the size } // DO NOT modify this class. It was generated from LeafRegionEntry.cpp - public final synchronized int updateEntrySize(EnableLRU capacityController, Object value) { + + public synchronized int updateEntrySize(EnableLRU capacityController, Object value) { int oldSize = getEntrySize(); int newSize = capacityController.entrySize(getKeyForSizing(), value); setEntrySize(newSize); int delta = newSize - oldSize; - // if ( debug ) log( "updateEntrySize key=" + getKey() - // + (_getValue() == Token.INVALID ? " invalid" : - // (_getValue() == Token.LOCAL_INVALID ? "local_invalid" : - // (_getValue()==null ? " evicted" : " valid"))) - // + " oldSize=" + oldSize - // + " newSize=" + this.size ); return delta; } - public final boolean testRecentlyUsed() { + public boolean testRecentlyUsed() { return areAnyBitsSet(RECENTLY_USED); } @Override - public final void setRecentlyUsed() { + public void setRecentlyUsed() { setBits(RECENTLY_USED); } - public final void unsetRecentlyUsed() { + public void unsetRecentlyUsed() { clearBits(~RECENTLY_USED); } - public final boolean testEvicted() { + public boolean testEvicted() { return areAnyBitsSet(EVICTED); } - public final void setEvicted() { + public void setEvicted() { setBits(EVICTED); } - public final void unsetEvicted() { + public void unsetEvicted() { clearBits(~EVICTED); } // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + private LRUClockNode nextLRU; private LRUClockNode prevLRU; private int size; - public final void setNextLRUNode(LRUClockNode next) { + public void setNextLRUNode(LRUClockNode next) { this.nextLRU = next; } - public final LRUClockNode nextLRUNode() { + public LRUClockNode nextLRUNode() { return this.nextLRU; } - public final void setPrevLRUNode(LRUClockNode prev) { + public void setPrevLRUNode(LRUClockNode prev) { this.prevLRU = prev; } - public final LRUClockNode prevLRUNode() { + public LRUClockNode prevLRUNode() { return this.prevLRU; } - public final int getEntrySize() { + public int getEntrySize() { return this.size; } - protected final void setEntrySize(int size) { + protected void setEntrySize(int size) { this.size = size; } // DO NOT modify this class. It was generated from LeafRegionEntry.cpp - // @Override - // public StringBuilder appendFieldsToString(final StringBuilder sb) { - // StringBuilder result = super.appendFieldsToString(sb); - // result.append("; prev=").append(this.prevLRU==null?"null":"not null"); - // result.append("; next=").append(this.nextLRU==null?"null":"not null"); - // return result; - // } + @Override public Object getKeyForSizing() { + + + // inline keys always report null for sizing since the size comes from the entry size return null; + } + + // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + // stats code @Override - public final void updateStatsForGet(boolean hit, long time) { + public void updateStatsForGet(boolean hit, long time) { setLastAccessed(time); if (hit) { incrementHitCount(); @@ -341,7 +380,7 @@ public class VersionedStatsDiskLRURegionEntryHeapStringKey2 } @Override - protected final void setLastModifiedAndAccessedTimes(long lastModified, long lastAccessed) { + protected void setLastModifiedAndAccessedTimes(long lastModified, long lastAccessed) { _setLastModified(lastModified); if (!DISABLE_ACCESS_TIME_UPDATE_ON_PUT) { setLastAccessed(lastAccessed); @@ -351,6 +390,7 @@ public class VersionedStatsDiskLRURegionEntryHeapStringKey2 private volatile long lastAccessed; private volatile int hitCount; private volatile int missCount; + private static final AtomicIntegerFieldUpdater<VersionedStatsDiskLRURegionEntryHeapStringKey2> hitCountUpdater = AtomicIntegerFieldUpdater.newUpdater(VersionedStatsDiskLRURegionEntryHeapStringKey2.class, "hitCount"); @@ -359,7 +399,7 @@ public class VersionedStatsDiskLRURegionEntryHeapStringKey2 "missCount"); @Override - public final long getLastAccessed() throws InternalStatisticsDisabledException { + public long getLastAccessed() throws InternalStatisticsDisabledException { return this.lastAccessed; } @@ -368,12 +408,12 @@ public class VersionedStatsDiskLRURegionEntryHeapStringKey2 } @Override - public final long getHitCount() throws InternalStatisticsDisabledException { + public long getHitCount() throws InternalStatisticsDisabledException { return this.hitCount & 0xFFFFFFFFL; } @Override - public final long getMissCount() throws InternalStatisticsDisabledException { + public long getMissCount() throws InternalStatisticsDisabledException { return this.missCount & 0xFFFFFFFFL; } @@ -386,14 +426,15 @@ public class VersionedStatsDiskLRURegionEntryHeapStringKey2 } @Override - public final void resetCounts() throws InternalStatisticsDisabledException { + public void resetCounts() throws InternalStatisticsDisabledException { hitCountUpdater.set(this, 0); missCountUpdater.set(this, 0); } // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + @Override - public final void txDidDestroy(long currTime) { + public void txDidDestroy(long currTime) { setLastModified(currTime); setLastAccessed(currTime); this.hitCount = 0; @@ -405,7 +446,10 @@ public class VersionedStatsDiskLRURegionEntryHeapStringKey2 return true; } + + // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + // versioned code private VersionSource memberID; private short entryVersionLowBytes; @@ -422,6 +466,7 @@ public class VersionedStatsDiskLRURegionEntryHeapStringKey2 return (((long) regionVersionHighBytes) << 32) | (regionVersionLowBytes & 0x00000000FFFFFFFFL); } + public long getVersionTimeStamp() { return getLastModified(); } @@ -439,6 +484,7 @@ public class VersionedStatsDiskLRURegionEntryHeapStringKey2 } // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + public void setVersions(VersionTag tag) { this.memberID = tag.getMemberID(); int eVersion = tag.getEntryVersion(); @@ -468,6 +514,7 @@ public class VersionedStatsDiskLRURegionEntryHeapStringKey2 } // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + public VersionTag asVersionTag() { VersionTag tag = VersionTag.create(memberID); tag.setEntryVersion(getEntryVersion()); @@ -500,8 +547,11 @@ public class VersionedStatsDiskLRURegionEntryHeapStringKey2 return this.regionVersionLowBytes; } + // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + // key code + // strlen is encoded in lowest 6 bits (max strlen is 63) // character encoding info is in bits 7 and 8 // The other bits are used to encoded character data. @@ -520,7 +570,7 @@ public class VersionedStatsDiskLRURegionEntryHeapStringKey2 } @Override - public final Object getKey() { + public Object getKey() { int keylen = getKeyLength(); char[] chars = new char[keylen]; long tmpBits1 = this.bits1; @@ -550,6 +600,7 @@ public class VersionedStatsDiskLRURegionEntryHeapStringKey2 } // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + @Override public boolean isKeyEqual(Object k) { if (k instanceof String) { @@ -592,5 +643,7 @@ public class VersionedStatsDiskLRURegionEntryHeapStringKey2 } return false; } + // DO NOT modify this class. It was generated from LeafRegionEntry.cpp } +
http://git-wip-us.apache.org/repos/asf/geode/blob/a4458531/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryHeapUUIDKey.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryHeapUUIDKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryHeapUUIDKey.java index b4934ed..4e201b9 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryHeapUUIDKey.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryHeapUUIDKey.java @@ -15,34 +15,47 @@ package org.apache.geode.internal.cache; // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + + + import java.util.UUID; + import java.util.concurrent.atomic.AtomicIntegerFieldUpdater; + import java.util.concurrent.atomic.AtomicLongFieldUpdater; + import org.apache.geode.cache.EntryEvent; + import org.apache.geode.internal.cache.lru.EnableLRU; + import org.apache.geode.internal.cache.persistence.DiskRecoveryStore; + import org.apache.geode.internal.InternalStatisticsDisabledException; + import org.apache.geode.internal.cache.lru.LRUClockNode; import org.apache.geode.internal.cache.lru.NewLRUClockHand; + import org.apache.geode.distributed.internal.membership.InternalDistributedMember; import org.apache.geode.internal.cache.versions.VersionSource; import org.apache.geode.internal.cache.versions.VersionStamp; import org.apache.geode.internal.cache.versions.VersionTag; + import org.apache.geode.internal.util.concurrent.CustomEntryConcurrentHashMap.HashEntry; // macros whose definition changes this class: -// disk: DISK -// lru: LRU -// stats: STATS -// versioned: VERSIONED +// disk: 1 +// lru: 1 +// stats: 1 +// versioned: 1 // offheap: OFFHEAP // One of the following key macros must be defined: // key object: KEY_OBJECT // key int: KEY_INT // key long: KEY_LONG -// key uuid: KEY_UUID +// key uuid: 1 // key string1: KEY_STRING1 // key string2: KEY_STRING2 + /** * Do not modify this class. It was generated. Instead modify LeafRegionEntry.cpp and then run * ./dev-tools/generateRegionEntryClasses.sh (it must be run from the top level directory). @@ -50,15 +63,34 @@ import org.apache.geode.internal.util.concurrent.CustomEntryConcurrentHashMap.Ha public class VersionedStatsDiskLRURegionEntryHeapUUIDKey extends VersionedStatsDiskLRURegionEntryHeap { public VersionedStatsDiskLRURegionEntryHeapUUIDKey(RegionEntryContext context, UUID key, - Object value) { - super(context, (value instanceof RecoveredEntry ? null : value)); + + + + Object value + + + + ) { + super(context, + + (value instanceof RecoveredEntry ? null : value) + + + + ); // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + initialize(context, value); + + + this.keyMostSigBits = key.getMostSignificantBits(); this.keyLeastSigBits = key.getLeastSignificantBits(); + } // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + // common code protected int hash; private HashEntry<Object, Object> next; @@ -67,10 +99,11 @@ public class VersionedStatsDiskLRURegionEntryHeapUUIDKey private static final AtomicLongFieldUpdater<VersionedStatsDiskLRURegionEntryHeapUUIDKey> lastModifiedUpdater = AtomicLongFieldUpdater.newUpdater(VersionedStatsDiskLRURegionEntryHeapUUIDKey.class, "lastModified"); + private volatile Object value; @Override - protected final Object getValueField() { + protected Object getValueField() { return this.value; } @@ -90,7 +123,7 @@ public class VersionedStatsDiskLRURegionEntryHeapUUIDKey /** * @see HashEntry#getEntryHash() */ - public final int getEntryHash() { + public int getEntryHash() { return this.hash; } @@ -101,19 +134,22 @@ public class VersionedStatsDiskLRURegionEntryHeapUUIDKey /** * @see HashEntry#getNextEntry() */ - public final HashEntry<Object, Object> getNextEntry() { + public HashEntry<Object, Object> getNextEntry() { return this.next; } /** * @see HashEntry#setNextEntry */ - public final void setNextEntry(final HashEntry<Object, Object> n) { + public 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 drs, Object value) { boolean isBackup; if (drs instanceof LocalRegion) { @@ -130,7 +166,7 @@ public class VersionedStatsDiskLRURegionEntryHeapUUIDKey } @Override - public final synchronized int updateAsyncEntrySize(EnableLRU capacityController) { + public synchronized int updateAsyncEntrySize(EnableLRU capacityController) { int oldSize = getEntrySize(); int newSize = capacityController.entrySize(getKeyForSizing(), null); setEntrySize(newSize); @@ -138,7 +174,9 @@ public class VersionedStatsDiskLRURegionEntryHeapUUIDKey return delta; } + // 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(); @@ -163,7 +201,6 @@ public class VersionedStatsDiskLRURegionEntryHeapUUIDKey void setDiskId(RegionEntry old) { this.id = ((AbstractDiskRegionEntry) old).getDiskId(); } - // // inlining DiskId // // always have these fields // /** @@ -203,108 +240,113 @@ public class VersionedStatsDiskLRURegionEntryHeapUUIDKey // // persistent // /** unique entry identifier * */ // private long keyId; + + + // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + // lru code @Override public void setDelayedDiskId(LocalRegion r) { + DiskStoreImpl ds = r.getDiskStore(); long maxOplogSize = ds.getMaxOplogSize(); this.id = DiskId.createDiskId(maxOplogSize, false /* over flow only */, ds.needsLinkedList()); + + + } - public final synchronized int updateEntrySize(EnableLRU capacityController) { + public synchronized int updateEntrySize(EnableLRU capacityController) { return updateEntrySize(capacityController, _getValue()); // OFHEAP: _getValue ok w/o incing // refcount because we are synced and // only getting the size } // DO NOT modify this class. It was generated from LeafRegionEntry.cpp - public final synchronized int updateEntrySize(EnableLRU capacityController, Object value) { + + public synchronized int updateEntrySize(EnableLRU capacityController, Object value) { int oldSize = getEntrySize(); int newSize = capacityController.entrySize(getKeyForSizing(), value); setEntrySize(newSize); int delta = newSize - oldSize; - // if ( debug ) log( "updateEntrySize key=" + getKey() - // + (_getValue() == Token.INVALID ? " invalid" : - // (_getValue() == Token.LOCAL_INVALID ? "local_invalid" : - // (_getValue()==null ? " evicted" : " valid"))) - // + " oldSize=" + oldSize - // + " newSize=" + this.size ); return delta; } - public final boolean testRecentlyUsed() { + public boolean testRecentlyUsed() { return areAnyBitsSet(RECENTLY_USED); } @Override - public final void setRecentlyUsed() { + public void setRecentlyUsed() { setBits(RECENTLY_USED); } - public final void unsetRecentlyUsed() { + public void unsetRecentlyUsed() { clearBits(~RECENTLY_USED); } - public final boolean testEvicted() { + public boolean testEvicted() { return areAnyBitsSet(EVICTED); } - public final void setEvicted() { + public void setEvicted() { setBits(EVICTED); } - public final void unsetEvicted() { + public void unsetEvicted() { clearBits(~EVICTED); } // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + private LRUClockNode nextLRU; private LRUClockNode prevLRU; private int size; - public final void setNextLRUNode(LRUClockNode next) { + public void setNextLRUNode(LRUClockNode next) { this.nextLRU = next; } - public final LRUClockNode nextLRUNode() { + public LRUClockNode nextLRUNode() { return this.nextLRU; } - public final void setPrevLRUNode(LRUClockNode prev) { + public void setPrevLRUNode(LRUClockNode prev) { this.prevLRU = prev; } - public final LRUClockNode prevLRUNode() { + public LRUClockNode prevLRUNode() { return this.prevLRU; } - public final int getEntrySize() { + public int getEntrySize() { return this.size; } - protected final void setEntrySize(int size) { + protected void setEntrySize(int size) { this.size = size; } // DO NOT modify this class. It was generated from LeafRegionEntry.cpp - // @Override - // public StringBuilder appendFieldsToString(final StringBuilder sb) { - // StringBuilder result = super.appendFieldsToString(sb); - // result.append("; prev=").append(this.prevLRU==null?"null":"not null"); - // result.append("; next=").append(this.nextLRU==null?"null":"not null"); - // return result; - // } + @Override public Object getKeyForSizing() { + + + // inline keys always report null for sizing since the size comes from the entry size return null; + } + + // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + // stats code @Override - public final void updateStatsForGet(boolean hit, long time) { + public void updateStatsForGet(boolean hit, long time) { setLastAccessed(time); if (hit) { incrementHitCount(); @@ -314,7 +356,7 @@ public class VersionedStatsDiskLRURegionEntryHeapUUIDKey } @Override - protected final void setLastModifiedAndAccessedTimes(long lastModified, long lastAccessed) { + protected void setLastModifiedAndAccessedTimes(long lastModified, long lastAccessed) { _setLastModified(lastModified); if (!DISABLE_ACCESS_TIME_UPDATE_ON_PUT) { setLastAccessed(lastAccessed); @@ -324,6 +366,7 @@ public class VersionedStatsDiskLRURegionEntryHeapUUIDKey private volatile long lastAccessed; private volatile int hitCount; private volatile int missCount; + private static final AtomicIntegerFieldUpdater<VersionedStatsDiskLRURegionEntryHeapUUIDKey> hitCountUpdater = AtomicIntegerFieldUpdater.newUpdater(VersionedStatsDiskLRURegionEntryHeapUUIDKey.class, "hitCount"); @@ -332,7 +375,7 @@ public class VersionedStatsDiskLRURegionEntryHeapUUIDKey "missCount"); @Override - public final long getLastAccessed() throws InternalStatisticsDisabledException { + public long getLastAccessed() throws InternalStatisticsDisabledException { return this.lastAccessed; } @@ -341,12 +384,12 @@ public class VersionedStatsDiskLRURegionEntryHeapUUIDKey } @Override - public final long getHitCount() throws InternalStatisticsDisabledException { + public long getHitCount() throws InternalStatisticsDisabledException { return this.hitCount & 0xFFFFFFFFL; } @Override - public final long getMissCount() throws InternalStatisticsDisabledException { + public long getMissCount() throws InternalStatisticsDisabledException { return this.missCount & 0xFFFFFFFFL; } @@ -359,14 +402,15 @@ public class VersionedStatsDiskLRURegionEntryHeapUUIDKey } @Override - public final void resetCounts() throws InternalStatisticsDisabledException { + public void resetCounts() throws InternalStatisticsDisabledException { hitCountUpdater.set(this, 0); missCountUpdater.set(this, 0); } // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + @Override - public final void txDidDestroy(long currTime) { + public void txDidDestroy(long currTime) { setLastModified(currTime); setLastAccessed(currTime); this.hitCount = 0; @@ -378,7 +422,10 @@ public class VersionedStatsDiskLRURegionEntryHeapUUIDKey return true; } + + // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + // versioned code private VersionSource memberID; private short entryVersionLowBytes; @@ -395,6 +442,7 @@ public class VersionedStatsDiskLRURegionEntryHeapUUIDKey return (((long) regionVersionHighBytes) << 32) | (regionVersionLowBytes & 0x00000000FFFFFFFFL); } + public long getVersionTimeStamp() { return getLastModified(); } @@ -412,6 +460,7 @@ public class VersionedStatsDiskLRURegionEntryHeapUUIDKey } // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + public void setVersions(VersionTag tag) { this.memberID = tag.getMemberID(); int eVersion = tag.getEntryVersion(); @@ -441,6 +490,7 @@ public class VersionedStatsDiskLRURegionEntryHeapUUIDKey } // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + public VersionTag asVersionTag() { VersionTag tag = VersionTag.create(memberID); tag.setEntryVersion(getEntryVersion()); @@ -473,13 +523,16 @@ public class VersionedStatsDiskLRURegionEntryHeapUUIDKey return this.regionVersionLowBytes; } + // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + // key code + private final long keyMostSigBits; private final long keyLeastSigBits; @Override - public final Object getKey() { + public Object getKey() { return new UUID(this.keyMostSigBits, this.keyLeastSigBits); } @@ -492,5 +545,8 @@ public class VersionedStatsDiskLRURegionEntryHeapUUIDKey } return false; } + + // DO NOT modify this class. It was generated from LeafRegionEntry.cpp } + http://git-wip-us.apache.org/repos/asf/geode/blob/a4458531/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryOffHeapIntKey.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryOffHeapIntKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryOffHeapIntKey.java index 6c5850e..a3df7e6 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryOffHeapIntKey.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryOffHeapIntKey.java @@ -15,37 +15,50 @@ package org.apache.geode.internal.cache; // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + + + import java.util.concurrent.atomic.AtomicIntegerFieldUpdater; + import java.util.concurrent.atomic.AtomicLongFieldUpdater; + import org.apache.geode.cache.EntryEvent; + import org.apache.geode.internal.cache.lru.EnableLRU; + import org.apache.geode.internal.cache.persistence.DiskRecoveryStore; + import org.apache.geode.internal.InternalStatisticsDisabledException; + import org.apache.geode.internal.cache.lru.LRUClockNode; import org.apache.geode.internal.cache.lru.NewLRUClockHand; + import org.apache.geode.distributed.internal.membership.InternalDistributedMember; import org.apache.geode.internal.cache.versions.VersionSource; import org.apache.geode.internal.cache.versions.VersionStamp; import org.apache.geode.internal.cache.versions.VersionTag; + import org.apache.geode.internal.offheap.OffHeapRegionEntryHelper; import org.apache.geode.internal.offheap.annotations.Released; import org.apache.geode.internal.offheap.annotations.Retained; import org.apache.geode.internal.offheap.annotations.Unretained; + import org.apache.geode.internal.util.concurrent.CustomEntryConcurrentHashMap.HashEntry; // macros whose definition changes this class: -// disk: DISK -// lru: LRU -// stats: STATS -// versioned: VERSIONED -// offheap: OFFHEAP +// disk: 1 +// lru: 1 +// stats: 1 +// versioned: 1 +// offheap: 1 // One of the following key macros must be defined: // key object: KEY_OBJECT -// key int: KEY_INT +// key int: 1 // key long: KEY_LONG // key uuid: KEY_UUID // key string1: KEY_STRING1 // key string2: KEY_STRING2 + /** * Do not modify this class. It was generated. Instead modify LeafRegionEntry.cpp and then run * ./dev-tools/generateRegionEntryClasses.sh (it must be run from the top level directory). @@ -53,14 +66,33 @@ import org.apache.geode.internal.util.concurrent.CustomEntryConcurrentHashMap.Ha public class VersionedStatsDiskLRURegionEntryOffHeapIntKey extends VersionedStatsDiskLRURegionEntryOffHeap { public VersionedStatsDiskLRURegionEntryOffHeapIntKey(RegionEntryContext context, int key, - @Retained Object value) { - super(context, (value instanceof RecoveredEntry ? null : value)); + + @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.key = key; + } // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + // common code protected int hash; private HashEntry<Object, Object> next; @@ -69,6 +101,7 @@ public class VersionedStatsDiskLRURegionEntryOffHeapIntKey private static final AtomicLongFieldUpdater<VersionedStatsDiskLRURegionEntryOffHeapIntKey> lastModifiedUpdater = AtomicLongFieldUpdater.newUpdater(VersionedStatsDiskLRURegionEntryOffHeapIntKey.class, "lastModified"); + /** * All access done using ohAddrUpdater so it is used even though the compiler can not tell it is. */ @@ -100,13 +133,19 @@ public class VersionedStatsDiskLRURegionEntryOffHeapIntKey // DO NOT modify this class. It was generated from LeafRegionEntry.cpp @Override + @Unretained protected void setValueField(@Unretained Object v) { + + + OffHeapRegionEntryHelper.setValue(this, v); } @Override + @Retained + public Object _getValueRetain(RegionEntryContext context, boolean decompress) { return OffHeapRegionEntryHelper._getValueRetain(this, decompress, context); } @@ -122,7 +161,9 @@ public class VersionedStatsDiskLRURegionEntryOffHeapIntKey } @Override + @Released + public void release() { OffHeapRegionEntryHelper.releaseEntry(this); } @@ -146,7 +187,7 @@ public class VersionedStatsDiskLRURegionEntryOffHeapIntKey /** * @see HashEntry#getEntryHash() */ - public final int getEntryHash() { + public int getEntryHash() { return this.hash; } @@ -157,19 +198,22 @@ public class VersionedStatsDiskLRURegionEntryOffHeapIntKey /** * @see HashEntry#getNextEntry() */ - public final HashEntry<Object, Object> getNextEntry() { + public HashEntry<Object, Object> getNextEntry() { return this.next; } /** * @see HashEntry#setNextEntry */ - public final void setNextEntry(final HashEntry<Object, Object> n) { + public 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 drs, Object value) { boolean isBackup; if (drs instanceof LocalRegion) { @@ -186,7 +230,7 @@ public class VersionedStatsDiskLRURegionEntryOffHeapIntKey } @Override - public final synchronized int updateAsyncEntrySize(EnableLRU capacityController) { + public synchronized int updateAsyncEntrySize(EnableLRU capacityController) { int oldSize = getEntrySize(); int newSize = capacityController.entrySize(getKeyForSizing(), null); setEntrySize(newSize); @@ -194,7 +238,9 @@ public class VersionedStatsDiskLRURegionEntryOffHeapIntKey return delta; } + // 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(); @@ -219,7 +265,6 @@ public class VersionedStatsDiskLRURegionEntryOffHeapIntKey void setDiskId(RegionEntry old) { this.id = ((AbstractDiskRegionEntry) old).getDiskId(); } - // // inlining DiskId // // always have these fields // /** @@ -259,108 +304,113 @@ public class VersionedStatsDiskLRURegionEntryOffHeapIntKey // // persistent // /** unique entry identifier * */ // private long keyId; + + + // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + // lru code @Override public void setDelayedDiskId(LocalRegion r) { + DiskStoreImpl ds = r.getDiskStore(); long maxOplogSize = ds.getMaxOplogSize(); this.id = DiskId.createDiskId(maxOplogSize, false /* over flow only */, ds.needsLinkedList()); + + + } - public final synchronized int updateEntrySize(EnableLRU capacityController) { + public synchronized int updateEntrySize(EnableLRU capacityController) { return updateEntrySize(capacityController, _getValue()); // OFHEAP: _getValue ok w/o incing // refcount because we are synced and // only getting the size } // DO NOT modify this class. It was generated from LeafRegionEntry.cpp - public final synchronized int updateEntrySize(EnableLRU capacityController, Object value) { + + public synchronized int updateEntrySize(EnableLRU capacityController, Object value) { int oldSize = getEntrySize(); int newSize = capacityController.entrySize(getKeyForSizing(), value); setEntrySize(newSize); int delta = newSize - oldSize; - // if ( debug ) log( "updateEntrySize key=" + getKey() - // + (_getValue() == Token.INVALID ? " invalid" : - // (_getValue() == Token.LOCAL_INVALID ? "local_invalid" : - // (_getValue()==null ? " evicted" : " valid"))) - // + " oldSize=" + oldSize - // + " newSize=" + this.size ); return delta; } - public final boolean testRecentlyUsed() { + public boolean testRecentlyUsed() { return areAnyBitsSet(RECENTLY_USED); } @Override - public final void setRecentlyUsed() { + public void setRecentlyUsed() { setBits(RECENTLY_USED); } - public final void unsetRecentlyUsed() { + public void unsetRecentlyUsed() { clearBits(~RECENTLY_USED); } - public final boolean testEvicted() { + public boolean testEvicted() { return areAnyBitsSet(EVICTED); } - public final void setEvicted() { + public void setEvicted() { setBits(EVICTED); } - public final void unsetEvicted() { + public void unsetEvicted() { clearBits(~EVICTED); } // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + private LRUClockNode nextLRU; private LRUClockNode prevLRU; private int size; - public final void setNextLRUNode(LRUClockNode next) { + public void setNextLRUNode(LRUClockNode next) { this.nextLRU = next; } - public final LRUClockNode nextLRUNode() { + public LRUClockNode nextLRUNode() { return this.nextLRU; } - public final void setPrevLRUNode(LRUClockNode prev) { + public void setPrevLRUNode(LRUClockNode prev) { this.prevLRU = prev; } - public final LRUClockNode prevLRUNode() { + public LRUClockNode prevLRUNode() { return this.prevLRU; } - public final int getEntrySize() { + public int getEntrySize() { return this.size; } - protected final void setEntrySize(int size) { + protected void setEntrySize(int size) { this.size = size; } // DO NOT modify this class. It was generated from LeafRegionEntry.cpp - // @Override - // public StringBuilder appendFieldsToString(final StringBuilder sb) { - // StringBuilder result = super.appendFieldsToString(sb); - // result.append("; prev=").append(this.prevLRU==null?"null":"not null"); - // result.append("; next=").append(this.nextLRU==null?"null":"not null"); - // return result; - // } + @Override public Object getKeyForSizing() { + + + // inline keys always report null for sizing since the size comes from the entry size return null; + } + + // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + // stats code @Override - public final void updateStatsForGet(boolean hit, long time) { + public void updateStatsForGet(boolean hit, long time) { setLastAccessed(time); if (hit) { incrementHitCount(); @@ -370,7 +420,7 @@ public class VersionedStatsDiskLRURegionEntryOffHeapIntKey } @Override - protected final void setLastModifiedAndAccessedTimes(long lastModified, long lastAccessed) { + protected void setLastModifiedAndAccessedTimes(long lastModified, long lastAccessed) { _setLastModified(lastModified); if (!DISABLE_ACCESS_TIME_UPDATE_ON_PUT) { setLastAccessed(lastAccessed); @@ -380,6 +430,7 @@ public class VersionedStatsDiskLRURegionEntryOffHeapIntKey private volatile long lastAccessed; private volatile int hitCount; private volatile int missCount; + private static final AtomicIntegerFieldUpdater<VersionedStatsDiskLRURegionEntryOffHeapIntKey> hitCountUpdater = AtomicIntegerFieldUpdater.newUpdater(VersionedStatsDiskLRURegionEntryOffHeapIntKey.class, "hitCount"); @@ -388,7 +439,7 @@ public class VersionedStatsDiskLRURegionEntryOffHeapIntKey "missCount"); @Override - public final long getLastAccessed() throws InternalStatisticsDisabledException { + public long getLastAccessed() throws InternalStatisticsDisabledException { return this.lastAccessed; } @@ -397,12 +448,12 @@ public class VersionedStatsDiskLRURegionEntryOffHeapIntKey } @Override - public final long getHitCount() throws InternalStatisticsDisabledException { + public long getHitCount() throws InternalStatisticsDisabledException { return this.hitCount & 0xFFFFFFFFL; } @Override - public final long getMissCount() throws InternalStatisticsDisabledException { + public long getMissCount() throws InternalStatisticsDisabledException { return this.missCount & 0xFFFFFFFFL; } @@ -415,14 +466,15 @@ public class VersionedStatsDiskLRURegionEntryOffHeapIntKey } @Override - public final void resetCounts() throws InternalStatisticsDisabledException { + public void resetCounts() throws InternalStatisticsDisabledException { hitCountUpdater.set(this, 0); missCountUpdater.set(this, 0); } // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + @Override - public final void txDidDestroy(long currTime) { + public void txDidDestroy(long currTime) { setLastModified(currTime); setLastAccessed(currTime); this.hitCount = 0; @@ -434,7 +486,10 @@ public class VersionedStatsDiskLRURegionEntryOffHeapIntKey return true; } + + // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + // versioned code private VersionSource memberID; private short entryVersionLowBytes; @@ -451,6 +506,7 @@ public class VersionedStatsDiskLRURegionEntryOffHeapIntKey return (((long) regionVersionHighBytes) << 32) | (regionVersionLowBytes & 0x00000000FFFFFFFFL); } + public long getVersionTimeStamp() { return getLastModified(); } @@ -468,6 +524,7 @@ public class VersionedStatsDiskLRURegionEntryOffHeapIntKey } // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + public void setVersions(VersionTag tag) { this.memberID = tag.getMemberID(); int eVersion = tag.getEntryVersion(); @@ -497,6 +554,7 @@ public class VersionedStatsDiskLRURegionEntryOffHeapIntKey } // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + public VersionTag asVersionTag() { VersionTag tag = VersionTag.create(memberID); tag.setEntryVersion(getEntryVersion()); @@ -529,12 +587,17 @@ public class VersionedStatsDiskLRURegionEntryOffHeapIntKey return this.regionVersionLowBytes; } + // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + // key code + + + private final int key; @Override - public final Object getKey() { + public Object getKey() { return this.key; } @@ -545,5 +608,8 @@ public class VersionedStatsDiskLRURegionEntryOffHeapIntKey } return false; } + + // DO NOT modify this class. It was generated from LeafRegionEntry.cpp } + http://git-wip-us.apache.org/repos/asf/geode/blob/a4458531/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryOffHeapLongKey.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryOffHeapLongKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryOffHeapLongKey.java index b9d60c5..d15b7fe 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryOffHeapLongKey.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryOffHeapLongKey.java @@ -15,37 +15,50 @@ package org.apache.geode.internal.cache; // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + + + import java.util.concurrent.atomic.AtomicIntegerFieldUpdater; + import java.util.concurrent.atomic.AtomicLongFieldUpdater; + import org.apache.geode.cache.EntryEvent; + import org.apache.geode.internal.cache.lru.EnableLRU; + import org.apache.geode.internal.cache.persistence.DiskRecoveryStore; + import org.apache.geode.internal.InternalStatisticsDisabledException; + import org.apache.geode.internal.cache.lru.LRUClockNode; import org.apache.geode.internal.cache.lru.NewLRUClockHand; + import org.apache.geode.distributed.internal.membership.InternalDistributedMember; import org.apache.geode.internal.cache.versions.VersionSource; import org.apache.geode.internal.cache.versions.VersionStamp; import org.apache.geode.internal.cache.versions.VersionTag; + import org.apache.geode.internal.offheap.OffHeapRegionEntryHelper; import org.apache.geode.internal.offheap.annotations.Released; import org.apache.geode.internal.offheap.annotations.Retained; import org.apache.geode.internal.offheap.annotations.Unretained; + import org.apache.geode.internal.util.concurrent.CustomEntryConcurrentHashMap.HashEntry; // macros whose definition changes this class: -// disk: DISK -// lru: LRU -// stats: STATS -// versioned: VERSIONED -// offheap: OFFHEAP +// disk: 1 +// lru: 1 +// stats: 1 +// versioned: 1 +// offheap: 1 // One of the following key macros must be defined: // key object: KEY_OBJECT // key int: KEY_INT -// key long: KEY_LONG +// key long: 1 // key uuid: KEY_UUID // key string1: KEY_STRING1 // key string2: KEY_STRING2 + /** * Do not modify this class. It was generated. Instead modify LeafRegionEntry.cpp and then run * ./dev-tools/generateRegionEntryClasses.sh (it must be run from the top level directory). @@ -53,14 +66,33 @@ import org.apache.geode.internal.util.concurrent.CustomEntryConcurrentHashMap.Ha public class VersionedStatsDiskLRURegionEntryOffHeapLongKey extends VersionedStatsDiskLRURegionEntryOffHeap { public VersionedStatsDiskLRURegionEntryOffHeapLongKey(RegionEntryContext context, long key, - @Retained Object value) { - super(context, (value instanceof RecoveredEntry ? null : value)); + + @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.key = key; + } // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + // common code protected int hash; private HashEntry<Object, Object> next; @@ -69,6 +101,7 @@ public class VersionedStatsDiskLRURegionEntryOffHeapLongKey private static final AtomicLongFieldUpdater<VersionedStatsDiskLRURegionEntryOffHeapLongKey> lastModifiedUpdater = AtomicLongFieldUpdater.newUpdater(VersionedStatsDiskLRURegionEntryOffHeapLongKey.class, "lastModified"); + /** * All access done using ohAddrUpdater so it is used even though the compiler can not tell it is. */ @@ -100,13 +133,19 @@ public class VersionedStatsDiskLRURegionEntryOffHeapLongKey // DO NOT modify this class. It was generated from LeafRegionEntry.cpp @Override + @Unretained protected void setValueField(@Unretained Object v) { + + + OffHeapRegionEntryHelper.setValue(this, v); } @Override + @Retained + public Object _getValueRetain(RegionEntryContext context, boolean decompress) { return OffHeapRegionEntryHelper._getValueRetain(this, decompress, context); } @@ -122,7 +161,9 @@ public class VersionedStatsDiskLRURegionEntryOffHeapLongKey } @Override + @Released + public void release() { OffHeapRegionEntryHelper.releaseEntry(this); } @@ -146,7 +187,7 @@ public class VersionedStatsDiskLRURegionEntryOffHeapLongKey /** * @see HashEntry#getEntryHash() */ - public final int getEntryHash() { + public int getEntryHash() { return this.hash; } @@ -157,19 +198,22 @@ public class VersionedStatsDiskLRURegionEntryOffHeapLongKey /** * @see HashEntry#getNextEntry() */ - public final HashEntry<Object, Object> getNextEntry() { + public HashEntry<Object, Object> getNextEntry() { return this.next; } /** * @see HashEntry#setNextEntry */ - public final void setNextEntry(final HashEntry<Object, Object> n) { + public 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 drs, Object value) { boolean isBackup; if (drs instanceof LocalRegion) { @@ -186,7 +230,7 @@ public class VersionedStatsDiskLRURegionEntryOffHeapLongKey } @Override - public final synchronized int updateAsyncEntrySize(EnableLRU capacityController) { + public synchronized int updateAsyncEntrySize(EnableLRU capacityController) { int oldSize = getEntrySize(); int newSize = capacityController.entrySize(getKeyForSizing(), null); setEntrySize(newSize); @@ -194,7 +238,9 @@ public class VersionedStatsDiskLRURegionEntryOffHeapLongKey return delta; } + // 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(); @@ -219,7 +265,6 @@ public class VersionedStatsDiskLRURegionEntryOffHeapLongKey void setDiskId(RegionEntry old) { this.id = ((AbstractDiskRegionEntry) old).getDiskId(); } - // // inlining DiskId // // always have these fields // /** @@ -259,108 +304,113 @@ public class VersionedStatsDiskLRURegionEntryOffHeapLongKey // // persistent // /** unique entry identifier * */ // private long keyId; + + + // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + // lru code @Override public void setDelayedDiskId(LocalRegion r) { + DiskStoreImpl ds = r.getDiskStore(); long maxOplogSize = ds.getMaxOplogSize(); this.id = DiskId.createDiskId(maxOplogSize, false /* over flow only */, ds.needsLinkedList()); + + + } - public final synchronized int updateEntrySize(EnableLRU capacityController) { + public synchronized int updateEntrySize(EnableLRU capacityController) { return updateEntrySize(capacityController, _getValue()); // OFHEAP: _getValue ok w/o incing // refcount because we are synced and // only getting the size } // DO NOT modify this class. It was generated from LeafRegionEntry.cpp - public final synchronized int updateEntrySize(EnableLRU capacityController, Object value) { + + public synchronized int updateEntrySize(EnableLRU capacityController, Object value) { int oldSize = getEntrySize(); int newSize = capacityController.entrySize(getKeyForSizing(), value); setEntrySize(newSize); int delta = newSize - oldSize; - // if ( debug ) log( "updateEntrySize key=" + getKey() - // + (_getValue() == Token.INVALID ? " invalid" : - // (_getValue() == Token.LOCAL_INVALID ? "local_invalid" : - // (_getValue()==null ? " evicted" : " valid"))) - // + " oldSize=" + oldSize - // + " newSize=" + this.size ); return delta; } - public final boolean testRecentlyUsed() { + public boolean testRecentlyUsed() { return areAnyBitsSet(RECENTLY_USED); } @Override - public final void setRecentlyUsed() { + public void setRecentlyUsed() { setBits(RECENTLY_USED); } - public final void unsetRecentlyUsed() { + public void unsetRecentlyUsed() { clearBits(~RECENTLY_USED); } - public final boolean testEvicted() { + public boolean testEvicted() { return areAnyBitsSet(EVICTED); } - public final void setEvicted() { + public void setEvicted() { setBits(EVICTED); } - public final void unsetEvicted() { + public void unsetEvicted() { clearBits(~EVICTED); } // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + private LRUClockNode nextLRU; private LRUClockNode prevLRU; private int size; - public final void setNextLRUNode(LRUClockNode next) { + public void setNextLRUNode(LRUClockNode next) { this.nextLRU = next; } - public final LRUClockNode nextLRUNode() { + public LRUClockNode nextLRUNode() { return this.nextLRU; } - public final void setPrevLRUNode(LRUClockNode prev) { + public void setPrevLRUNode(LRUClockNode prev) { this.prevLRU = prev; } - public final LRUClockNode prevLRUNode() { + public LRUClockNode prevLRUNode() { return this.prevLRU; } - public final int getEntrySize() { + public int getEntrySize() { return this.size; } - protected final void setEntrySize(int size) { + protected void setEntrySize(int size) { this.size = size; } // DO NOT modify this class. It was generated from LeafRegionEntry.cpp - // @Override - // public StringBuilder appendFieldsToString(final StringBuilder sb) { - // StringBuilder result = super.appendFieldsToString(sb); - // result.append("; prev=").append(this.prevLRU==null?"null":"not null"); - // result.append("; next=").append(this.nextLRU==null?"null":"not null"); - // return result; - // } + @Override public Object getKeyForSizing() { + + + // inline keys always report null for sizing since the size comes from the entry size return null; + } + + // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + // stats code @Override - public final void updateStatsForGet(boolean hit, long time) { + public void updateStatsForGet(boolean hit, long time) { setLastAccessed(time); if (hit) { incrementHitCount(); @@ -370,7 +420,7 @@ public class VersionedStatsDiskLRURegionEntryOffHeapLongKey } @Override - protected final void setLastModifiedAndAccessedTimes(long lastModified, long lastAccessed) { + protected void setLastModifiedAndAccessedTimes(long lastModified, long lastAccessed) { _setLastModified(lastModified); if (!DISABLE_ACCESS_TIME_UPDATE_ON_PUT) { setLastAccessed(lastAccessed); @@ -380,6 +430,7 @@ public class VersionedStatsDiskLRURegionEntryOffHeapLongKey private volatile long lastAccessed; private volatile int hitCount; private volatile int missCount; + private static final AtomicIntegerFieldUpdater<VersionedStatsDiskLRURegionEntryOffHeapLongKey> hitCountUpdater = AtomicIntegerFieldUpdater.newUpdater(VersionedStatsDiskLRURegionEntryOffHeapLongKey.class, "hitCount"); @@ -388,7 +439,7 @@ public class VersionedStatsDiskLRURegionEntryOffHeapLongKey "missCount"); @Override - public final long getLastAccessed() throws InternalStatisticsDisabledException { + public long getLastAccessed() throws InternalStatisticsDisabledException { return this.lastAccessed; } @@ -397,12 +448,12 @@ public class VersionedStatsDiskLRURegionEntryOffHeapLongKey } @Override - public final long getHitCount() throws InternalStatisticsDisabledException { + public long getHitCount() throws InternalStatisticsDisabledException { return this.hitCount & 0xFFFFFFFFL; } @Override - public final long getMissCount() throws InternalStatisticsDisabledException { + public long getMissCount() throws InternalStatisticsDisabledException { return this.missCount & 0xFFFFFFFFL; } @@ -415,14 +466,15 @@ public class VersionedStatsDiskLRURegionEntryOffHeapLongKey } @Override - public final void resetCounts() throws InternalStatisticsDisabledException { + public void resetCounts() throws InternalStatisticsDisabledException { hitCountUpdater.set(this, 0); missCountUpdater.set(this, 0); } // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + @Override - public final void txDidDestroy(long currTime) { + public void txDidDestroy(long currTime) { setLastModified(currTime); setLastAccessed(currTime); this.hitCount = 0; @@ -434,7 +486,10 @@ public class VersionedStatsDiskLRURegionEntryOffHeapLongKey return true; } + + // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + // versioned code private VersionSource memberID; private short entryVersionLowBytes; @@ -451,6 +506,7 @@ public class VersionedStatsDiskLRURegionEntryOffHeapLongKey return (((long) regionVersionHighBytes) << 32) | (regionVersionLowBytes & 0x00000000FFFFFFFFL); } + public long getVersionTimeStamp() { return getLastModified(); } @@ -468,6 +524,7 @@ public class VersionedStatsDiskLRURegionEntryOffHeapLongKey } // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + public void setVersions(VersionTag tag) { this.memberID = tag.getMemberID(); int eVersion = tag.getEntryVersion(); @@ -497,6 +554,7 @@ public class VersionedStatsDiskLRURegionEntryOffHeapLongKey } // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + public VersionTag asVersionTag() { VersionTag tag = VersionTag.create(memberID); tag.setEntryVersion(getEntryVersion()); @@ -529,12 +587,15 @@ public class VersionedStatsDiskLRURegionEntryOffHeapLongKey return this.regionVersionLowBytes; } + // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + // key code + private final long key; @Override - public final Object getKey() { + public Object getKey() { return this.key; } @@ -545,5 +606,8 @@ public class VersionedStatsDiskLRURegionEntryOffHeapLongKey } return false; } + + // DO NOT modify this class. It was generated from LeafRegionEntry.cpp } + http://git-wip-us.apache.org/repos/asf/geode/blob/a4458531/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryOffHeapObjectKey.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryOffHeapObjectKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryOffHeapObjectKey.java index 63098fa..a8f1e2a 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryOffHeapObjectKey.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryOffHeapObjectKey.java @@ -15,37 +15,50 @@ package org.apache.geode.internal.cache; // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + + + import java.util.concurrent.atomic.AtomicIntegerFieldUpdater; + import java.util.concurrent.atomic.AtomicLongFieldUpdater; + import org.apache.geode.cache.EntryEvent; + import org.apache.geode.internal.cache.lru.EnableLRU; + import org.apache.geode.internal.cache.persistence.DiskRecoveryStore; + import org.apache.geode.internal.InternalStatisticsDisabledException; + import org.apache.geode.internal.cache.lru.LRUClockNode; import org.apache.geode.internal.cache.lru.NewLRUClockHand; + import org.apache.geode.distributed.internal.membership.InternalDistributedMember; import org.apache.geode.internal.cache.versions.VersionSource; import org.apache.geode.internal.cache.versions.VersionStamp; import org.apache.geode.internal.cache.versions.VersionTag; + import org.apache.geode.internal.offheap.OffHeapRegionEntryHelper; import org.apache.geode.internal.offheap.annotations.Released; import org.apache.geode.internal.offheap.annotations.Retained; import org.apache.geode.internal.offheap.annotations.Unretained; + import org.apache.geode.internal.util.concurrent.CustomEntryConcurrentHashMap.HashEntry; // macros whose definition changes this class: -// disk: DISK -// lru: LRU -// stats: STATS -// versioned: VERSIONED -// offheap: OFFHEAP +// disk: 1 +// lru: 1 +// stats: 1 +// versioned: 1 +// offheap: 1 // One of the following key macros must be defined: -// key object: KEY_OBJECT +// key object: 1 // key int: KEY_INT // key long: KEY_LONG // key uuid: KEY_UUID // key string1: KEY_STRING1 // key string2: KEY_STRING2 + /** * Do not modify this class. It was generated. Instead modify LeafRegionEntry.cpp and then run * ./dev-tools/generateRegionEntryClasses.sh (it must be run from the top level directory). @@ -53,14 +66,32 @@ import org.apache.geode.internal.util.concurrent.CustomEntryConcurrentHashMap.Ha public class VersionedStatsDiskLRURegionEntryOffHeapObjectKey extends VersionedStatsDiskLRURegionEntryOffHeap { public VersionedStatsDiskLRURegionEntryOffHeapObjectKey(RegionEntryContext context, Object key, - @Retained Object value) { - super(context, (value instanceof RecoveredEntry ? null : value)); + + @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.key = key; + } // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + // common code protected int hash; private HashEntry<Object, Object> next; @@ -69,6 +100,7 @@ public class VersionedStatsDiskLRURegionEntryOffHeapObjectKey private static final AtomicLongFieldUpdater<VersionedStatsDiskLRURegionEntryOffHeapObjectKey> lastModifiedUpdater = AtomicLongFieldUpdater.newUpdater(VersionedStatsDiskLRURegionEntryOffHeapObjectKey.class, "lastModified"); + /** * All access done using ohAddrUpdater so it is used even though the compiler can not tell it is. */ @@ -100,13 +132,19 @@ public class VersionedStatsDiskLRURegionEntryOffHeapObjectKey // DO NOT modify this class. It was generated from LeafRegionEntry.cpp @Override + @Unretained protected void setValueField(@Unretained Object v) { + + + OffHeapRegionEntryHelper.setValue(this, v); } @Override + @Retained + public Object _getValueRetain(RegionEntryContext context, boolean decompress) { return OffHeapRegionEntryHelper._getValueRetain(this, decompress, context); } @@ -122,7 +160,9 @@ public class VersionedStatsDiskLRURegionEntryOffHeapObjectKey } @Override + @Released + public void release() { OffHeapRegionEntryHelper.releaseEntry(this); } @@ -146,7 +186,7 @@ public class VersionedStatsDiskLRURegionEntryOffHeapObjectKey /** * @see HashEntry#getEntryHash() */ - public final int getEntryHash() { + public int getEntryHash() { return this.hash; } @@ -157,19 +197,22 @@ public class VersionedStatsDiskLRURegionEntryOffHeapObjectKey /** * @see HashEntry#getNextEntry() */ - public final HashEntry<Object, Object> getNextEntry() { + public HashEntry<Object, Object> getNextEntry() { return this.next; } /** * @see HashEntry#setNextEntry */ - public final void setNextEntry(final HashEntry<Object, Object> n) { + public 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 drs, Object value) { boolean isBackup; if (drs instanceof LocalRegion) { @@ -186,7 +229,7 @@ public class VersionedStatsDiskLRURegionEntryOffHeapObjectKey } @Override - public final synchronized int updateAsyncEntrySize(EnableLRU capacityController) { + public synchronized int updateAsyncEntrySize(EnableLRU capacityController) { int oldSize = getEntrySize(); int newSize = capacityController.entrySize(getKeyForSizing(), null); setEntrySize(newSize); @@ -194,7 +237,9 @@ public class VersionedStatsDiskLRURegionEntryOffHeapObjectKey return delta; } + // 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(); @@ -219,7 +264,6 @@ public class VersionedStatsDiskLRURegionEntryOffHeapObjectKey void setDiskId(RegionEntry old) { this.id = ((AbstractDiskRegionEntry) old).getDiskId(); } - // // inlining DiskId // // always have these fields // /** @@ -259,108 +303,113 @@ public class VersionedStatsDiskLRURegionEntryOffHeapObjectKey // // persistent // /** unique entry identifier * */ // private long keyId; + + + // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + // lru code @Override public void setDelayedDiskId(LocalRegion r) { + DiskStoreImpl ds = r.getDiskStore(); long maxOplogSize = ds.getMaxOplogSize(); this.id = DiskId.createDiskId(maxOplogSize, false /* over flow only */, ds.needsLinkedList()); + + + } - public final synchronized int updateEntrySize(EnableLRU capacityController) { + public synchronized int updateEntrySize(EnableLRU capacityController) { return updateEntrySize(capacityController, _getValue()); // OFHEAP: _getValue ok w/o incing // refcount because we are synced and // only getting the size } // DO NOT modify this class. It was generated from LeafRegionEntry.cpp - public final synchronized int updateEntrySize(EnableLRU capacityController, Object value) { + + public synchronized int updateEntrySize(EnableLRU capacityController, Object value) { int oldSize = getEntrySize(); int newSize = capacityController.entrySize(getKeyForSizing(), value); setEntrySize(newSize); int delta = newSize - oldSize; - // if ( debug ) log( "updateEntrySize key=" + getKey() - // + (_getValue() == Token.INVALID ? " invalid" : - // (_getValue() == Token.LOCAL_INVALID ? "local_invalid" : - // (_getValue()==null ? " evicted" : " valid"))) - // + " oldSize=" + oldSize - // + " newSize=" + this.size ); return delta; } - public final boolean testRecentlyUsed() { + public boolean testRecentlyUsed() { return areAnyBitsSet(RECENTLY_USED); } @Override - public final void setRecentlyUsed() { + public void setRecentlyUsed() { setBits(RECENTLY_USED); } - public final void unsetRecentlyUsed() { + public void unsetRecentlyUsed() { clearBits(~RECENTLY_USED); } - public final boolean testEvicted() { + public boolean testEvicted() { return areAnyBitsSet(EVICTED); } - public final void setEvicted() { + public void setEvicted() { setBits(EVICTED); } - public final void unsetEvicted() { + public void unsetEvicted() { clearBits(~EVICTED); } // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + private LRUClockNode nextLRU; private LRUClockNode prevLRU; private int size; - public final void setNextLRUNode(LRUClockNode next) { + public void setNextLRUNode(LRUClockNode next) { this.nextLRU = next; } - public final LRUClockNode nextLRUNode() { + public LRUClockNode nextLRUNode() { return this.nextLRU; } - public final void setPrevLRUNode(LRUClockNode prev) { + public void setPrevLRUNode(LRUClockNode prev) { this.prevLRU = prev; } - public final LRUClockNode prevLRUNode() { + public LRUClockNode prevLRUNode() { return this.prevLRU; } - public final int getEntrySize() { + public int getEntrySize() { return this.size; } - protected final void setEntrySize(int size) { + protected void setEntrySize(int size) { this.size = size; } // DO NOT modify this class. It was generated from LeafRegionEntry.cpp - // @Override - // public StringBuilder appendFieldsToString(final StringBuilder sb) { - // StringBuilder result = super.appendFieldsToString(sb); - // result.append("; prev=").append(this.prevLRU==null?"null":"not null"); - // result.append("; next=").append(this.nextLRU==null?"null":"not null"); - // return result; - // } + @Override public Object getKeyForSizing() { + // default implementation. return getKey(); + + + } + + // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + // stats code @Override - public final void updateStatsForGet(boolean hit, long time) { + public void updateStatsForGet(boolean hit, long time) { setLastAccessed(time); if (hit) { incrementHitCount(); @@ -370,7 +419,7 @@ public class VersionedStatsDiskLRURegionEntryOffHeapObjectKey } @Override - protected final void setLastModifiedAndAccessedTimes(long lastModified, long lastAccessed) { + protected void setLastModifiedAndAccessedTimes(long lastModified, long lastAccessed) { _setLastModified(lastModified); if (!DISABLE_ACCESS_TIME_UPDATE_ON_PUT) { setLastAccessed(lastAccessed); @@ -380,6 +429,7 @@ public class VersionedStatsDiskLRURegionEntryOffHeapObjectKey private volatile long lastAccessed; private volatile int hitCount; private volatile int missCount; + private static final AtomicIntegerFieldUpdater<VersionedStatsDiskLRURegionEntryOffHeapObjectKey> hitCountUpdater = AtomicIntegerFieldUpdater.newUpdater(VersionedStatsDiskLRURegionEntryOffHeapObjectKey.class, "hitCount"); @@ -388,7 +438,7 @@ public class VersionedStatsDiskLRURegionEntryOffHeapObjectKey "missCount"); @Override - public final long getLastAccessed() throws InternalStatisticsDisabledException { + public long getLastAccessed() throws InternalStatisticsDisabledException { return this.lastAccessed; } @@ -397,12 +447,12 @@ public class VersionedStatsDiskLRURegionEntryOffHeapObjectKey } @Override - public final long getHitCount() throws InternalStatisticsDisabledException { + public long getHitCount() throws InternalStatisticsDisabledException { return this.hitCount & 0xFFFFFFFFL; } @Override - public final long getMissCount() throws InternalStatisticsDisabledException { + public long getMissCount() throws InternalStatisticsDisabledException { return this.missCount & 0xFFFFFFFFL; } @@ -415,14 +465,15 @@ public class VersionedStatsDiskLRURegionEntryOffHeapObjectKey } @Override - public final void resetCounts() throws InternalStatisticsDisabledException { + public void resetCounts() throws InternalStatisticsDisabledException { hitCountUpdater.set(this, 0); missCountUpdater.set(this, 0); } // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + @Override - public final void txDidDestroy(long currTime) { + public void txDidDestroy(long currTime) { setLastModified(currTime); setLastAccessed(currTime); this.hitCount = 0; @@ -434,7 +485,10 @@ public class VersionedStatsDiskLRURegionEntryOffHeapObjectKey return true; } + + // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + // versioned code private VersionSource memberID; private short entryVersionLowBytes; @@ -451,6 +505,7 @@ public class VersionedStatsDiskLRURegionEntryOffHeapObjectKey return (((long) regionVersionHighBytes) << 32) | (regionVersionLowBytes & 0x00000000FFFFFFFFL); } + public long getVersionTimeStamp() { return getLastModified(); } @@ -468,6 +523,7 @@ public class VersionedStatsDiskLRURegionEntryOffHeapObjectKey } // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + public void setVersions(VersionTag tag) { this.memberID = tag.getMemberID(); int eVersion = tag.getEntryVersion(); @@ -497,6 +553,7 @@ public class VersionedStatsDiskLRURegionEntryOffHeapObjectKey } // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + public VersionTag asVersionTag() { VersionTag tag = VersionTag.create(memberID); tag.setEntryVersion(getEntryVersion()); @@ -529,13 +586,19 @@ public class VersionedStatsDiskLRURegionEntryOffHeapObjectKey return this.regionVersionLowBytes; } + // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + // key code + private final Object key; @Override - public final Object getKey() { + public Object getKey() { return this.key; } + + // DO NOT modify this class. It was generated from LeafRegionEntry.cpp } + http://git-wip-us.apache.org/repos/asf/geode/blob/a4458531/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryOffHeapStringKey1.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryOffHeapStringKey1.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryOffHeapStringKey1.java index 45cbc49..0ced50b 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryOffHeapStringKey1.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsDiskLRURegionEntryOffHeapStringKey1.java @@ -15,37 +15,50 @@ package org.apache.geode.internal.cache; // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + + + import java.util.concurrent.atomic.AtomicIntegerFieldUpdater; + import java.util.concurrent.atomic.AtomicLongFieldUpdater; + import org.apache.geode.cache.EntryEvent; + import org.apache.geode.internal.cache.lru.EnableLRU; + import org.apache.geode.internal.cache.persistence.DiskRecoveryStore; + import org.apache.geode.internal.InternalStatisticsDisabledException; + import org.apache.geode.internal.cache.lru.LRUClockNode; import org.apache.geode.internal.cache.lru.NewLRUClockHand; + import org.apache.geode.distributed.internal.membership.InternalDistributedMember; import org.apache.geode.internal.cache.versions.VersionSource; import org.apache.geode.internal.cache.versions.VersionStamp; import org.apache.geode.internal.cache.versions.VersionTag; + import org.apache.geode.internal.offheap.OffHeapRegionEntryHelper; import org.apache.geode.internal.offheap.annotations.Released; import org.apache.geode.internal.offheap.annotations.Retained; import org.apache.geode.internal.offheap.annotations.Unretained; + import org.apache.geode.internal.util.concurrent.CustomEntryConcurrentHashMap.HashEntry; // macros whose definition changes this class: -// disk: DISK -// lru: LRU -// stats: STATS -// versioned: VERSIONED -// offheap: OFFHEAP +// disk: 1 +// lru: 1 +// stats: 1 +// versioned: 1 +// offheap: 1 // One of the following key macros must be defined: // key object: KEY_OBJECT // key int: KEY_INT // key long: KEY_LONG // key uuid: KEY_UUID -// key string1: KEY_STRING1 +// key string1: 1 // key string2: KEY_STRING2 + /** * Do not modify this class. It was generated. Instead modify LeafRegionEntry.cpp and then run * ./dev-tools/generateRegionEntryClasses.sh (it must be run from the top level directory). @@ -53,10 +66,25 @@ import org.apache.geode.internal.util.concurrent.CustomEntryConcurrentHashMap.Ha public class VersionedStatsDiskLRURegionEntryOffHeapStringKey1 extends VersionedStatsDiskLRURegionEntryOffHeap { public VersionedStatsDiskLRURegionEntryOffHeapStringKey1(RegionEntryContext context, String key, - @Retained Object value, boolean byteEncode) { - super(context, (value instanceof RecoveredEntry ? null : value)); + + @Retained + + Object value + + , boolean byteEncode + + ) { + super(context, + + (value instanceof RecoveredEntry ? null : value) + + + + ); // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + initialize(context, value); + // caller has already confirmed that key.length <= MAX_INLINE_STRING_KEY long tmpBits1 = 0L; if (byteEncode) { @@ -75,9 +103,11 @@ public class VersionedStatsDiskLRURegionEntryOffHeapStringKey1 } tmpBits1 |= key.length(); this.bits1 = tmpBits1; + } // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + // common code protected int hash; private HashEntry<Object, Object> next; @@ -86,6 +116,7 @@ public class VersionedStatsDiskLRURegionEntryOffHeapStringKey1 private static final AtomicLongFieldUpdater<VersionedStatsDiskLRURegionEntryOffHeapStringKey1> lastModifiedUpdater = AtomicLongFieldUpdater.newUpdater(VersionedStatsDiskLRURegionEntryOffHeapStringKey1.class, "lastModified"); + /** * All access done using ohAddrUpdater so it is used even though the compiler can not tell it is. */ @@ -117,13 +148,19 @@ public class VersionedStatsDiskLRURegionEntryOffHeapStringKey1 // DO NOT modify this class. It was generated from LeafRegionEntry.cpp @Override + @Unretained protected void setValueField(@Unretained Object v) { + + + OffHeapRegionEntryHelper.setValue(this, v); } @Override + @Retained + public Object _getValueRetain(RegionEntryContext context, boolean decompress) { return OffHeapRegionEntryHelper._getValueRetain(this, decompress, context); } @@ -139,7 +176,9 @@ public class VersionedStatsDiskLRURegionEntryOffHeapStringKey1 } @Override + @Released + public void release() { OffHeapRegionEntryHelper.releaseEntry(this); } @@ -163,7 +202,7 @@ public class VersionedStatsDiskLRURegionEntryOffHeapStringKey1 /** * @see HashEntry#getEntryHash() */ - public final int getEntryHash() { + public int getEntryHash() { return this.hash; } @@ -174,19 +213,22 @@ public class VersionedStatsDiskLRURegionEntryOffHeapStringKey1 /** * @see HashEntry#getNextEntry() */ - public final HashEntry<Object, Object> getNextEntry() { + public HashEntry<Object, Object> getNextEntry() { return this.next; } /** * @see HashEntry#setNextEntry */ - public final void setNextEntry(final HashEntry<Object, Object> n) { + public 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 drs, Object value) { boolean isBackup; if (drs instanceof LocalRegion) { @@ -203,7 +245,7 @@ public class VersionedStatsDiskLRURegionEntryOffHeapStringKey1 } @Override - public final synchronized int updateAsyncEntrySize(EnableLRU capacityController) { + public synchronized int updateAsyncEntrySize(EnableLRU capacityController) { int oldSize = getEntrySize(); int newSize = capacityController.entrySize(getKeyForSizing(), null); setEntrySize(newSize); @@ -211,7 +253,9 @@ public class VersionedStatsDiskLRURegionEntryOffHeapStringKey1 return delta; } + // 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(); @@ -236,7 +280,6 @@ public class VersionedStatsDiskLRURegionEntryOffHeapStringKey1 void setDiskId(RegionEntry old) { this.id = ((AbstractDiskRegionEntry) old).getDiskId(); } - // // inlining DiskId // // always have these fields // /** @@ -276,108 +319,113 @@ public class VersionedStatsDiskLRURegionEntryOffHeapStringKey1 // // persistent // /** unique entry identifier * */ // private long keyId; + + + // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + // lru code @Override public void setDelayedDiskId(LocalRegion r) { + DiskStoreImpl ds = r.getDiskStore(); long maxOplogSize = ds.getMaxOplogSize(); this.id = DiskId.createDiskId(maxOplogSize, false /* over flow only */, ds.needsLinkedList()); + + + } - public final synchronized int updateEntrySize(EnableLRU capacityController) { + public synchronized int updateEntrySize(EnableLRU capacityController) { return updateEntrySize(capacityController, _getValue()); // OFHEAP: _getValue ok w/o incing // refcount because we are synced and // only getting the size } // DO NOT modify this class. It was generated from LeafRegionEntry.cpp - public final synchronized int updateEntrySize(EnableLRU capacityController, Object value) { + + public synchronized int updateEntrySize(EnableLRU capacityController, Object value) { int oldSize = getEntrySize(); int newSize = capacityController.entrySize(getKeyForSizing(), value); setEntrySize(newSize); int delta = newSize - oldSize; - // if ( debug ) log( "updateEntrySize key=" + getKey() - // + (_getValue() == Token.INVALID ? " invalid" : - // (_getValue() == Token.LOCAL_INVALID ? "local_invalid" : - // (_getValue()==null ? " evicted" : " valid"))) - // + " oldSize=" + oldSize - // + " newSize=" + this.size ); return delta; } - public final boolean testRecentlyUsed() { + public boolean testRecentlyUsed() { return areAnyBitsSet(RECENTLY_USED); } @Override - public final void setRecentlyUsed() { + public void setRecentlyUsed() { setBits(RECENTLY_USED); } - public final void unsetRecentlyUsed() { + public void unsetRecentlyUsed() { clearBits(~RECENTLY_USED); } - public final boolean testEvicted() { + public boolean testEvicted() { return areAnyBitsSet(EVICTED); } - public final void setEvicted() { + public void setEvicted() { setBits(EVICTED); } - public final void unsetEvicted() { + public void unsetEvicted() { clearBits(~EVICTED); } // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + private LRUClockNode nextLRU; private LRUClockNode prevLRU; private int size; - public final void setNextLRUNode(LRUClockNode next) { + public void setNextLRUNode(LRUClockNode next) { this.nextLRU = next; } - public final LRUClockNode nextLRUNode() { + public LRUClockNode nextLRUNode() { return this.nextLRU; } - public final void setPrevLRUNode(LRUClockNode prev) { + public void setPrevLRUNode(LRUClockNode prev) { this.prevLRU = prev; } - public final LRUClockNode prevLRUNode() { + public LRUClockNode prevLRUNode() { return this.prevLRU; } - public final int getEntrySize() { + public int getEntrySize() { return this.size; } - protected final void setEntrySize(int size) { + protected void setEntrySize(int size) { this.size = size; } // DO NOT modify this class. It was generated from LeafRegionEntry.cpp - // @Override - // public StringBuilder appendFieldsToString(final StringBuilder sb) { - // StringBuilder result = super.appendFieldsToString(sb); - // result.append("; prev=").append(this.prevLRU==null?"null":"not null"); - // result.append("; next=").append(this.nextLRU==null?"null":"not null"); - // return result; - // } + @Override public Object getKeyForSizing() { + + + // inline keys always report null for sizing since the size comes from the entry size return null; + } + + // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + // stats code @Override - public final void updateStatsForGet(boolean hit, long time) { + public void updateStatsForGet(boolean hit, long time) { setLastAccessed(time); if (hit) { incrementHitCount(); @@ -387,7 +435,7 @@ public class VersionedStatsDiskLRURegionEntryOffHeapStringKey1 } @Override - protected final void setLastModifiedAndAccessedTimes(long lastModified, long lastAccessed) { + protected void setLastModifiedAndAccessedTimes(long lastModified, long lastAccessed) { _setLastModified(lastModified); if (!DISABLE_ACCESS_TIME_UPDATE_ON_PUT) { setLastAccessed(lastAccessed); @@ -397,6 +445,7 @@ public class VersionedStatsDiskLRURegionEntryOffHeapStringKey1 private volatile long lastAccessed; private volatile int hitCount; private volatile int missCount; + private static final AtomicIntegerFieldUpdater<VersionedStatsDiskLRURegionEntryOffHeapStringKey1> hitCountUpdater = AtomicIntegerFieldUpdater.newUpdater(VersionedStatsDiskLRURegionEntryOffHeapStringKey1.class, "hitCount"); @@ -405,7 +454,7 @@ public class VersionedStatsDiskLRURegionEntryOffHeapStringKey1 "missCount"); @Override - public final long getLastAccessed() throws InternalStatisticsDisabledException { + public long getLastAccessed() throws InternalStatisticsDisabledException { return this.lastAccessed; } @@ -414,12 +463,12 @@ public class VersionedStatsDiskLRURegionEntryOffHeapStringKey1 } @Override - public final long getHitCount() throws InternalStatisticsDisabledException { + public long getHitCount() throws InternalStatisticsDisabledException { return this.hitCount & 0xFFFFFFFFL; } @Override - public final long getMissCount() throws InternalStatisticsDisabledException { + public long getMissCount() throws InternalStatisticsDisabledException { return this.missCount & 0xFFFFFFFFL; } @@ -432,14 +481,15 @@ public class VersionedStatsDiskLRURegionEntryOffHeapStringKey1 } @Override - public final void resetCounts() throws InternalStatisticsDisabledException { + public void resetCounts() throws InternalStatisticsDisabledException { hitCountUpdater.set(this, 0); missCountUpdater.set(this, 0); } // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + @Override - public final void txDidDestroy(long currTime) { + public void txDidDestroy(long currTime) { setLastModified(currTime); setLastAccessed(currTime); this.hitCount = 0; @@ -451,7 +501,10 @@ public class VersionedStatsDiskLRURegionEntryOffHeapStringKey1 return true; } + + // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + // versioned code private VersionSource memberID; private short entryVersionLowBytes; @@ -468,6 +521,7 @@ public class VersionedStatsDiskLRURegionEntryOffHeapStringKey1 return (((long) regionVersionHighBytes) << 32) | (regionVersionLowBytes & 0x00000000FFFFFFFFL); } + public long getVersionTimeStamp() { return getLastModified(); } @@ -485,6 +539,7 @@ public class VersionedStatsDiskLRURegionEntryOffHeapStringKey1 } // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + public void setVersions(VersionTag tag) { this.memberID = tag.getMemberID(); int eVersion = tag.getEntryVersion(); @@ -514,6 +569,7 @@ public class VersionedStatsDiskLRURegionEntryOffHeapStringKey1 } // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + public VersionTag asVersionTag() { VersionTag tag = VersionTag.create(memberID); tag.setEntryVersion(getEntryVersion()); @@ -546,8 +602,11 @@ public class VersionedStatsDiskLRURegionEntryOffHeapStringKey1 return this.regionVersionLowBytes; } + // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + // key code + private final long bits1; private int getKeyLength() { @@ -561,7 +620,7 @@ public class VersionedStatsDiskLRURegionEntryOffHeapStringKey1 } @Override - public final Object getKey() { + public Object getKey() { int keylen = getKeyLength(); char[] chars = new char[keylen]; long tmpBits1 = this.bits1; @@ -580,6 +639,7 @@ public class VersionedStatsDiskLRURegionEntryOffHeapStringKey1 } // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + @Override public boolean isKeyEqual(Object k) { if (k instanceof String) { @@ -609,5 +669,8 @@ public class VersionedStatsDiskLRURegionEntryOffHeapStringKey1 } return false; } + + // DO NOT modify this class. It was generated from LeafRegionEntry.cpp } +
