http://git-wip-us.apache.org/repos/asf/geode/blob/a4458531/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeapObjectKey.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeapObjectKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeapObjectKey.java index 5cde18e..21e755a 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeapObjectKey.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeapObjectKey.java @@ -15,44 +15,72 @@ 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.internal.cache.lru.EnableLRU; + import org.apache.geode.internal.cache.persistence.DiskRecoveryStore; + import org.apache.geode.internal.InternalStatisticsDisabledException; + 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 +// disk: 1 // lru: LRU -// stats: STATS +// stats: 1 // versioned: VERSIONED -// offheap: OFFHEAP +// 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). */ public class VMStatsDiskRegionEntryOffHeapObjectKey extends VMStatsDiskRegionEntryOffHeap { public VMStatsDiskRegionEntryOffHeapObjectKey(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; @@ -61,6 +89,7 @@ public class VMStatsDiskRegionEntryOffHeapObjectKey extends VMStatsDiskRegionEnt private static final AtomicLongFieldUpdater<VMStatsDiskRegionEntryOffHeapObjectKey> lastModifiedUpdater = AtomicLongFieldUpdater.newUpdater(VMStatsDiskRegionEntryOffHeapObjectKey.class, "lastModified"); + /** * All access done using ohAddrUpdater so it is used even though the compiler can not tell it is. */ @@ -91,13 +120,19 @@ public class VMStatsDiskRegionEntryOffHeapObjectKey extends VMStatsDiskRegionEnt // 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); } @@ -113,7 +148,9 @@ public class VMStatsDiskRegionEntryOffHeapObjectKey extends VMStatsDiskRegionEnt } @Override + @Released + public void release() { OffHeapRegionEntryHelper.releaseEntry(this); } @@ -137,7 +174,7 @@ public class VMStatsDiskRegionEntryOffHeapObjectKey extends VMStatsDiskRegionEnt /** * @see HashEntry#getEntryHash() */ - public final int getEntryHash() { + public int getEntryHash() { return this.hash; } @@ -148,19 +185,22 @@ public class VMStatsDiskRegionEntryOffHeapObjectKey extends VMStatsDiskRegionEnt /** * @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 context, Object value) { diskInitialize(context, value); } @@ -170,7 +210,9 @@ public class VMStatsDiskRegionEntryOffHeapObjectKey extends VMStatsDiskRegionEnt 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(); @@ -195,7 +237,6 @@ public class VMStatsDiskRegionEntryOffHeapObjectKey extends VMStatsDiskRegionEnt void setDiskId(RegionEntry old) { this.id = ((AbstractDiskRegionEntry) old).getDiskId(); } - // // inlining DiskId // // always have these fields // /** @@ -235,10 +276,14 @@ public class VMStatsDiskRegionEntryOffHeapObjectKey extends VMStatsDiskRegionEnt // // persistent // /** unique entry identifier * */ // private long keyId; + + + // 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(); @@ -248,7 +293,7 @@ public class VMStatsDiskRegionEntryOffHeapObjectKey extends VMStatsDiskRegionEnt } @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); @@ -258,6 +303,7 @@ public class VMStatsDiskRegionEntryOffHeapObjectKey extends VMStatsDiskRegionEnt private volatile long lastAccessed; private volatile int hitCount; private volatile int missCount; + private static final AtomicIntegerFieldUpdater<VMStatsDiskRegionEntryOffHeapObjectKey> hitCountUpdater = AtomicIntegerFieldUpdater.newUpdater(VMStatsDiskRegionEntryOffHeapObjectKey.class, "hitCount"); @@ -266,7 +312,7 @@ public class VMStatsDiskRegionEntryOffHeapObjectKey extends VMStatsDiskRegionEnt "missCount"); @Override - public final long getLastAccessed() throws InternalStatisticsDisabledException { + public long getLastAccessed() throws InternalStatisticsDisabledException { return this.lastAccessed; } @@ -275,12 +321,12 @@ public class VMStatsDiskRegionEntryOffHeapObjectKey extends VMStatsDiskRegionEnt } @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; } @@ -293,14 +339,15 @@ public class VMStatsDiskRegionEntryOffHeapObjectKey extends VMStatsDiskRegionEnt } @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; @@ -312,13 +359,20 @@ public class VMStatsDiskRegionEntryOffHeapObjectKey extends VMStatsDiskRegionEnt return true; } + + // 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/VMStatsDiskRegionEntryOffHeapStringKey1.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeapStringKey1.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeapStringKey1.java index c42095c..95f48ed 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeapStringKey1.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeapStringKey1.java @@ -15,40 +15,65 @@ 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.internal.cache.lru.EnableLRU; + import org.apache.geode.internal.cache.persistence.DiskRecoveryStore; + import org.apache.geode.internal.InternalStatisticsDisabledException; + 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 +// disk: 1 // lru: LRU -// stats: STATS +// stats: 1 // versioned: VERSIONED -// offheap: OFFHEAP +// 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). */ public class VMStatsDiskRegionEntryOffHeapStringKey1 extends VMStatsDiskRegionEntryOffHeap { public VMStatsDiskRegionEntryOffHeapStringKey1(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) { @@ -67,9 +92,11 @@ public class VMStatsDiskRegionEntryOffHeapStringKey1 extends VMStatsDiskRegionEn } 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; @@ -78,6 +105,7 @@ public class VMStatsDiskRegionEntryOffHeapStringKey1 extends VMStatsDiskRegionEn private static final AtomicLongFieldUpdater<VMStatsDiskRegionEntryOffHeapStringKey1> lastModifiedUpdater = AtomicLongFieldUpdater.newUpdater(VMStatsDiskRegionEntryOffHeapStringKey1.class, "lastModified"); + /** * All access done using ohAddrUpdater so it is used even though the compiler can not tell it is. */ @@ -108,13 +136,19 @@ public class VMStatsDiskRegionEntryOffHeapStringKey1 extends VMStatsDiskRegionEn // 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); } @@ -130,7 +164,9 @@ public class VMStatsDiskRegionEntryOffHeapStringKey1 extends VMStatsDiskRegionEn } @Override + @Released + public void release() { OffHeapRegionEntryHelper.releaseEntry(this); } @@ -154,7 +190,7 @@ public class VMStatsDiskRegionEntryOffHeapStringKey1 extends VMStatsDiskRegionEn /** * @see HashEntry#getEntryHash() */ - public final int getEntryHash() { + public int getEntryHash() { return this.hash; } @@ -165,19 +201,22 @@ public class VMStatsDiskRegionEntryOffHeapStringKey1 extends VMStatsDiskRegionEn /** * @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 context, Object value) { diskInitialize(context, value); } @@ -187,7 +226,9 @@ public class VMStatsDiskRegionEntryOffHeapStringKey1 extends VMStatsDiskRegionEn 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(); @@ -212,7 +253,6 @@ public class VMStatsDiskRegionEntryOffHeapStringKey1 extends VMStatsDiskRegionEn void setDiskId(RegionEntry old) { this.id = ((AbstractDiskRegionEntry) old).getDiskId(); } - // // inlining DiskId // // always have these fields // /** @@ -252,10 +292,14 @@ public class VMStatsDiskRegionEntryOffHeapStringKey1 extends VMStatsDiskRegionEn // // persistent // /** unique entry identifier * */ // private long keyId; + + + // 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(); @@ -265,7 +309,7 @@ public class VMStatsDiskRegionEntryOffHeapStringKey1 extends VMStatsDiskRegionEn } @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); @@ -275,6 +319,7 @@ public class VMStatsDiskRegionEntryOffHeapStringKey1 extends VMStatsDiskRegionEn private volatile long lastAccessed; private volatile int hitCount; private volatile int missCount; + private static final AtomicIntegerFieldUpdater<VMStatsDiskRegionEntryOffHeapStringKey1> hitCountUpdater = AtomicIntegerFieldUpdater.newUpdater(VMStatsDiskRegionEntryOffHeapStringKey1.class, "hitCount"); @@ -283,7 +328,7 @@ public class VMStatsDiskRegionEntryOffHeapStringKey1 extends VMStatsDiskRegionEn "missCount"); @Override - public final long getLastAccessed() throws InternalStatisticsDisabledException { + public long getLastAccessed() throws InternalStatisticsDisabledException { return this.lastAccessed; } @@ -292,12 +337,12 @@ public class VMStatsDiskRegionEntryOffHeapStringKey1 extends VMStatsDiskRegionEn } @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; } @@ -310,14 +355,15 @@ public class VMStatsDiskRegionEntryOffHeapStringKey1 extends VMStatsDiskRegionEn } @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; @@ -329,8 +375,12 @@ public class VMStatsDiskRegionEntryOffHeapStringKey1 extends VMStatsDiskRegionEn return true; } + + // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + // key code + private final long bits1; private int getKeyLength() { @@ -344,7 +394,7 @@ public class VMStatsDiskRegionEntryOffHeapStringKey1 extends VMStatsDiskRegionEn } @Override - public final Object getKey() { + public Object getKey() { int keylen = getKeyLength(); char[] chars = new char[keylen]; long tmpBits1 = this.bits1; @@ -363,6 +413,7 @@ public class VMStatsDiskRegionEntryOffHeapStringKey1 extends VMStatsDiskRegionEn } // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + @Override public boolean isKeyEqual(Object k) { if (k instanceof String) { @@ -392,5 +443,8 @@ public class VMStatsDiskRegionEntryOffHeapStringKey1 extends VMStatsDiskRegionEn } 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/VMStatsDiskRegionEntryOffHeapStringKey2.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeapStringKey2.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeapStringKey2.java index 515c555..2363dca 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeapStringKey2.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeapStringKey2.java @@ -15,40 +15,65 @@ 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.internal.cache.lru.EnableLRU; + import org.apache.geode.internal.cache.persistence.DiskRecoveryStore; + import org.apache.geode.internal.InternalStatisticsDisabledException; + 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 +// disk: 1 // lru: LRU -// stats: STATS +// stats: 1 // versioned: VERSIONED -// offheap: OFFHEAP +// 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 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). */ public class VMStatsDiskRegionEntryOffHeapStringKey2 extends VMStatsDiskRegionEntryOffHeap { public VMStatsDiskRegionEntryOffHeapStringKey2(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; long tmpBits2 = 0L; @@ -79,9 +104,11 @@ public class VMStatsDiskRegionEntryOffHeapStringKey2 extends VMStatsDiskRegionEn 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; @@ -90,6 +117,7 @@ public class VMStatsDiskRegionEntryOffHeapStringKey2 extends VMStatsDiskRegionEn private static final AtomicLongFieldUpdater<VMStatsDiskRegionEntryOffHeapStringKey2> lastModifiedUpdater = AtomicLongFieldUpdater.newUpdater(VMStatsDiskRegionEntryOffHeapStringKey2.class, "lastModified"); + /** * All access done using ohAddrUpdater so it is used even though the compiler can not tell it is. */ @@ -120,13 +148,19 @@ public class VMStatsDiskRegionEntryOffHeapStringKey2 extends VMStatsDiskRegionEn // 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); } @@ -142,7 +176,9 @@ public class VMStatsDiskRegionEntryOffHeapStringKey2 extends VMStatsDiskRegionEn } @Override + @Released + public void release() { OffHeapRegionEntryHelper.releaseEntry(this); } @@ -166,7 +202,7 @@ public class VMStatsDiskRegionEntryOffHeapStringKey2 extends VMStatsDiskRegionEn /** * @see HashEntry#getEntryHash() */ - public final int getEntryHash() { + public int getEntryHash() { return this.hash; } @@ -177,19 +213,22 @@ public class VMStatsDiskRegionEntryOffHeapStringKey2 extends VMStatsDiskRegionEn /** * @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 context, Object value) { diskInitialize(context, value); } @@ -199,7 +238,9 @@ public class VMStatsDiskRegionEntryOffHeapStringKey2 extends VMStatsDiskRegionEn 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(); @@ -224,7 +265,6 @@ public class VMStatsDiskRegionEntryOffHeapStringKey2 extends VMStatsDiskRegionEn void setDiskId(RegionEntry old) { this.id = ((AbstractDiskRegionEntry) old).getDiskId(); } - // // inlining DiskId // // always have these fields // /** @@ -264,10 +304,14 @@ public class VMStatsDiskRegionEntryOffHeapStringKey2 extends VMStatsDiskRegionEn // // persistent // /** unique entry identifier * */ // private long keyId; + + + // 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(); @@ -277,7 +321,7 @@ public class VMStatsDiskRegionEntryOffHeapStringKey2 extends VMStatsDiskRegionEn } @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); @@ -287,6 +331,7 @@ public class VMStatsDiskRegionEntryOffHeapStringKey2 extends VMStatsDiskRegionEn private volatile long lastAccessed; private volatile int hitCount; private volatile int missCount; + private static final AtomicIntegerFieldUpdater<VMStatsDiskRegionEntryOffHeapStringKey2> hitCountUpdater = AtomicIntegerFieldUpdater.newUpdater(VMStatsDiskRegionEntryOffHeapStringKey2.class, "hitCount"); @@ -295,7 +340,7 @@ public class VMStatsDiskRegionEntryOffHeapStringKey2 extends VMStatsDiskRegionEn "missCount"); @Override - public final long getLastAccessed() throws InternalStatisticsDisabledException { + public long getLastAccessed() throws InternalStatisticsDisabledException { return this.lastAccessed; } @@ -304,12 +349,12 @@ public class VMStatsDiskRegionEntryOffHeapStringKey2 extends VMStatsDiskRegionEn } @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; } @@ -322,14 +367,15 @@ public class VMStatsDiskRegionEntryOffHeapStringKey2 extends VMStatsDiskRegionEn } @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; @@ -341,8 +387,12 @@ public class VMStatsDiskRegionEntryOffHeapStringKey2 extends VMStatsDiskRegionEn return true; } + + // 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. @@ -361,7 +411,7 @@ public class VMStatsDiskRegionEntryOffHeapStringKey2 extends VMStatsDiskRegionEn } @Override - public final Object getKey() { + public Object getKey() { int keylen = getKeyLength(); char[] chars = new char[keylen]; long tmpBits1 = this.bits1; @@ -391,6 +441,7 @@ public class VMStatsDiskRegionEntryOffHeapStringKey2 extends VMStatsDiskRegionEn } // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + @Override public boolean isKeyEqual(Object k) { if (k instanceof String) { @@ -433,5 +484,7 @@ public class VMStatsDiskRegionEntryOffHeapStringKey2 extends VMStatsDiskRegionEn } 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/VMStatsDiskRegionEntryOffHeapUUIDKey.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeapUUIDKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeapUUIDKey.java index 214990e..e7e64a9 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeapUUIDKey.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeapUUIDKey.java @@ -15,46 +15,76 @@ 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.internal.cache.lru.EnableLRU; + import org.apache.geode.internal.cache.persistence.DiskRecoveryStore; + import org.apache.geode.internal.InternalStatisticsDisabledException; + 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 +// disk: 1 // lru: LRU -// stats: STATS +// stats: 1 // versioned: VERSIONED -// offheap: OFFHEAP +// 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 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). */ public class VMStatsDiskRegionEntryOffHeapUUIDKey extends VMStatsDiskRegionEntryOffHeap { public VMStatsDiskRegionEntryOffHeapUUIDKey(RegionEntryContext context, UUID 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.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; @@ -62,6 +92,7 @@ public class VMStatsDiskRegionEntryOffHeapUUIDKey extends VMStatsDiskRegionEntry private volatile long lastModified; private static final AtomicLongFieldUpdater<VMStatsDiskRegionEntryOffHeapUUIDKey> lastModifiedUpdater = AtomicLongFieldUpdater.newUpdater(VMStatsDiskRegionEntryOffHeapUUIDKey.class, "lastModified"); + /** * All access done using ohAddrUpdater so it is used even though the compiler can not tell it is. */ @@ -92,13 +123,19 @@ public class VMStatsDiskRegionEntryOffHeapUUIDKey extends VMStatsDiskRegionEntry // 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); } @@ -114,7 +151,9 @@ public class VMStatsDiskRegionEntryOffHeapUUIDKey extends VMStatsDiskRegionEntry } @Override + @Released + public void release() { OffHeapRegionEntryHelper.releaseEntry(this); } @@ -138,7 +177,7 @@ public class VMStatsDiskRegionEntryOffHeapUUIDKey extends VMStatsDiskRegionEntry /** * @see HashEntry#getEntryHash() */ - public final int getEntryHash() { + public int getEntryHash() { return this.hash; } @@ -149,19 +188,22 @@ public class VMStatsDiskRegionEntryOffHeapUUIDKey extends VMStatsDiskRegionEntry /** * @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 context, Object value) { diskInitialize(context, value); } @@ -171,7 +213,9 @@ public class VMStatsDiskRegionEntryOffHeapUUIDKey extends VMStatsDiskRegionEntry 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(); @@ -196,7 +240,6 @@ public class VMStatsDiskRegionEntryOffHeapUUIDKey extends VMStatsDiskRegionEntry void setDiskId(RegionEntry old) { this.id = ((AbstractDiskRegionEntry) old).getDiskId(); } - // // inlining DiskId // // always have these fields // /** @@ -236,10 +279,14 @@ public class VMStatsDiskRegionEntryOffHeapUUIDKey extends VMStatsDiskRegionEntry // // persistent // /** unique entry identifier * */ // private long keyId; + + + // 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(); @@ -249,7 +296,7 @@ public class VMStatsDiskRegionEntryOffHeapUUIDKey extends VMStatsDiskRegionEntry } @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); @@ -259,13 +306,14 @@ public class VMStatsDiskRegionEntryOffHeapUUIDKey extends VMStatsDiskRegionEntry private volatile long lastAccessed; private volatile int hitCount; private volatile int missCount; + private static final AtomicIntegerFieldUpdater<VMStatsDiskRegionEntryOffHeapUUIDKey> hitCountUpdater = AtomicIntegerFieldUpdater.newUpdater(VMStatsDiskRegionEntryOffHeapUUIDKey.class, "hitCount"); private static final AtomicIntegerFieldUpdater<VMStatsDiskRegionEntryOffHeapUUIDKey> missCountUpdater = AtomicIntegerFieldUpdater.newUpdater(VMStatsDiskRegionEntryOffHeapUUIDKey.class, "missCount"); @Override - public final long getLastAccessed() throws InternalStatisticsDisabledException { + public long getLastAccessed() throws InternalStatisticsDisabledException { return this.lastAccessed; } @@ -274,12 +322,12 @@ public class VMStatsDiskRegionEntryOffHeapUUIDKey extends VMStatsDiskRegionEntry } @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; } @@ -292,14 +340,15 @@ public class VMStatsDiskRegionEntryOffHeapUUIDKey extends VMStatsDiskRegionEntry } @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; @@ -311,13 +360,17 @@ public class VMStatsDiskRegionEntryOffHeapUUIDKey extends VMStatsDiskRegionEntry return true; } + + // 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); } @@ -330,5 +383,8 @@ public class VMStatsDiskRegionEntryOffHeapUUIDKey extends VMStatsDiskRegionEntry } 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/VMStatsLRURegionEntryHeapIntKey.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryHeapIntKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryHeapIntKey.java index 4a3f0c9..a577c23 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryHeapIntKey.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryHeapIntKey.java @@ -15,39 +15,67 @@ 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.internal.cache.lru.EnableLRU; + 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.internal.util.concurrent.CustomEntryConcurrentHashMap.HashEntry; // macros whose definition changes this class: // disk: DISK -// lru: LRU -// stats: STATS +// lru: 1 +// stats: 1 // versioned: VERSIONED // offheap: OFFHEAP // 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). */ public class VMStatsLRURegionEntryHeapIntKey extends VMStatsLRURegionEntryHeap { - public VMStatsLRURegionEntryHeapIntKey(RegionEntryContext context, int key, Object value) { - super(context, value); + public VMStatsLRURegionEntryHeapIntKey(RegionEntryContext context, int key, + + + + 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; @@ -55,10 +83,11 @@ public class VMStatsLRURegionEntryHeapIntKey extends VMStatsLRURegionEntryHeap { private volatile long lastModified; private static final AtomicLongFieldUpdater<VMStatsLRURegionEntryHeapIntKey> lastModifiedUpdater = AtomicLongFieldUpdater.newUpdater(VMStatsLRURegionEntryHeapIntKey.class, "lastModified"); + private volatile Object value; @Override - protected final Object getValueField() { + protected Object getValueField() { return this.value; } @@ -78,7 +107,7 @@ public class VMStatsLRURegionEntryHeapIntKey extends VMStatsLRURegionEntryHeap { /** * @see HashEntry#getEntryHash() */ - public final int getEntryHash() { + public int getEntryHash() { return this.hash; } @@ -89,117 +118,121 @@ public class VMStatsLRURegionEntryHeapIntKey extends VMStatsLRURegionEntryHeap { /** * @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 + // lru code @Override public void setDelayedDiskId(LocalRegion r) { + + + // nothing needed for LRUs with no disk + } - 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(); @@ -209,7 +242,7 @@ public class VMStatsLRURegionEntryHeapIntKey extends VMStatsLRURegionEntryHeap { } @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); @@ -219,13 +252,14 @@ public class VMStatsLRURegionEntryHeapIntKey extends VMStatsLRURegionEntryHeap { private volatile long lastAccessed; private volatile int hitCount; private volatile int missCount; + private static final AtomicIntegerFieldUpdater<VMStatsLRURegionEntryHeapIntKey> hitCountUpdater = AtomicIntegerFieldUpdater.newUpdater(VMStatsLRURegionEntryHeapIntKey.class, "hitCount"); private static final AtomicIntegerFieldUpdater<VMStatsLRURegionEntryHeapIntKey> missCountUpdater = AtomicIntegerFieldUpdater.newUpdater(VMStatsLRURegionEntryHeapIntKey.class, "missCount"); @Override - public final long getLastAccessed() throws InternalStatisticsDisabledException { + public long getLastAccessed() throws InternalStatisticsDisabledException { return this.lastAccessed; } @@ -234,12 +268,12 @@ public class VMStatsLRURegionEntryHeapIntKey extends VMStatsLRURegionEntryHeap { } @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; } @@ -252,14 +286,15 @@ public class VMStatsLRURegionEntryHeapIntKey extends VMStatsLRURegionEntryHeap { } @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; @@ -271,12 +306,18 @@ public class VMStatsLRURegionEntryHeapIntKey extends VMStatsLRURegionEntryHeap { return true; } + + // 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; } @@ -287,5 +328,8 @@ public class VMStatsLRURegionEntryHeapIntKey extends VMStatsLRURegionEntryHeap { } 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/VMStatsLRURegionEntryHeapLongKey.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryHeapLongKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryHeapLongKey.java index 976e22e..893d565 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryHeapLongKey.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryHeapLongKey.java @@ -15,39 +15,67 @@ 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.internal.cache.lru.EnableLRU; + 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.internal.util.concurrent.CustomEntryConcurrentHashMap.HashEntry; // macros whose definition changes this class: // disk: DISK -// lru: LRU -// stats: STATS +// lru: 1 +// stats: 1 // versioned: VERSIONED // offheap: OFFHEAP // 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). */ public class VMStatsLRURegionEntryHeapLongKey extends VMStatsLRURegionEntryHeap { - public VMStatsLRURegionEntryHeapLongKey(RegionEntryContext context, long key, Object value) { - super(context, value); + public VMStatsLRURegionEntryHeapLongKey(RegionEntryContext context, long key, + + + + 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; @@ -55,10 +83,11 @@ public class VMStatsLRURegionEntryHeapLongKey extends VMStatsLRURegionEntryHeap private volatile long lastModified; private static final AtomicLongFieldUpdater<VMStatsLRURegionEntryHeapLongKey> lastModifiedUpdater = AtomicLongFieldUpdater.newUpdater(VMStatsLRURegionEntryHeapLongKey.class, "lastModified"); + private volatile Object value; @Override - protected final Object getValueField() { + protected Object getValueField() { return this.value; } @@ -78,7 +107,7 @@ public class VMStatsLRURegionEntryHeapLongKey extends VMStatsLRURegionEntryHeap /** * @see HashEntry#getEntryHash() */ - public final int getEntryHash() { + public int getEntryHash() { return this.hash; } @@ -89,117 +118,121 @@ public class VMStatsLRURegionEntryHeapLongKey extends VMStatsLRURegionEntryHeap /** * @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 + // lru code @Override public void setDelayedDiskId(LocalRegion r) { + + + // nothing needed for LRUs with no disk + } - 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(); @@ -209,7 +242,7 @@ public class VMStatsLRURegionEntryHeapLongKey extends VMStatsLRURegionEntryHeap } @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); @@ -219,13 +252,14 @@ public class VMStatsLRURegionEntryHeapLongKey extends VMStatsLRURegionEntryHeap private volatile long lastAccessed; private volatile int hitCount; private volatile int missCount; + private static final AtomicIntegerFieldUpdater<VMStatsLRURegionEntryHeapLongKey> hitCountUpdater = AtomicIntegerFieldUpdater.newUpdater(VMStatsLRURegionEntryHeapLongKey.class, "hitCount"); private static final AtomicIntegerFieldUpdater<VMStatsLRURegionEntryHeapLongKey> missCountUpdater = AtomicIntegerFieldUpdater.newUpdater(VMStatsLRURegionEntryHeapLongKey.class, "missCount"); @Override - public final long getLastAccessed() throws InternalStatisticsDisabledException { + public long getLastAccessed() throws InternalStatisticsDisabledException { return this.lastAccessed; } @@ -234,12 +268,12 @@ public class VMStatsLRURegionEntryHeapLongKey extends VMStatsLRURegionEntryHeap } @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; } @@ -252,14 +286,15 @@ public class VMStatsLRURegionEntryHeapLongKey extends VMStatsLRURegionEntryHeap } @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; @@ -271,12 +306,16 @@ public class VMStatsLRURegionEntryHeapLongKey extends VMStatsLRURegionEntryHeap return true; } + + // 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; } @@ -287,5 +326,8 @@ public class VMStatsLRURegionEntryHeapLongKey extends VMStatsLRURegionEntryHeap } 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/VMStatsLRURegionEntryHeapObjectKey.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryHeapObjectKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryHeapObjectKey.java index df6c10d..a0af97e 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryHeapObjectKey.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryHeapObjectKey.java @@ -15,39 +15,67 @@ 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.internal.cache.lru.EnableLRU; + 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.internal.util.concurrent.CustomEntryConcurrentHashMap.HashEntry; // macros whose definition changes this class: // disk: DISK -// lru: LRU -// stats: STATS +// lru: 1 +// stats: 1 // versioned: VERSIONED // offheap: OFFHEAP // 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). */ public class VMStatsLRURegionEntryHeapObjectKey extends VMStatsLRURegionEntryHeap { - public VMStatsLRURegionEntryHeapObjectKey(RegionEntryContext context, Object key, Object value) { - super(context, value); + public VMStatsLRURegionEntryHeapObjectKey(RegionEntryContext context, Object key, + + + + 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; @@ -55,10 +83,11 @@ public class VMStatsLRURegionEntryHeapObjectKey extends VMStatsLRURegionEntryHea private volatile long lastModified; private static final AtomicLongFieldUpdater<VMStatsLRURegionEntryHeapObjectKey> lastModifiedUpdater = AtomicLongFieldUpdater.newUpdater(VMStatsLRURegionEntryHeapObjectKey.class, "lastModified"); + private volatile Object value; @Override - protected final Object getValueField() { + protected Object getValueField() { return this.value; } @@ -78,7 +107,7 @@ public class VMStatsLRURegionEntryHeapObjectKey extends VMStatsLRURegionEntryHea /** * @see HashEntry#getEntryHash() */ - public final int getEntryHash() { + public int getEntryHash() { return this.hash; } @@ -89,117 +118,121 @@ public class VMStatsLRURegionEntryHeapObjectKey extends VMStatsLRURegionEntryHea /** * @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 + // lru code @Override public void setDelayedDiskId(LocalRegion r) { + + + // nothing needed for LRUs with no disk + } - 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(); @@ -209,7 +242,7 @@ public class VMStatsLRURegionEntryHeapObjectKey extends VMStatsLRURegionEntryHea } @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); @@ -219,13 +252,14 @@ public class VMStatsLRURegionEntryHeapObjectKey extends VMStatsLRURegionEntryHea private volatile long lastAccessed; private volatile int hitCount; private volatile int missCount; + private static final AtomicIntegerFieldUpdater<VMStatsLRURegionEntryHeapObjectKey> hitCountUpdater = AtomicIntegerFieldUpdater.newUpdater(VMStatsLRURegionEntryHeapObjectKey.class, "hitCount"); private static final AtomicIntegerFieldUpdater<VMStatsLRURegionEntryHeapObjectKey> missCountUpdater = AtomicIntegerFieldUpdater.newUpdater(VMStatsLRURegionEntryHeapObjectKey.class, "missCount"); @Override - public final long getLastAccessed() throws InternalStatisticsDisabledException { + public long getLastAccessed() throws InternalStatisticsDisabledException { return this.lastAccessed; } @@ -234,12 +268,12 @@ public class VMStatsLRURegionEntryHeapObjectKey extends VMStatsLRURegionEntryHea } @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; } @@ -252,14 +286,15 @@ public class VMStatsLRURegionEntryHeapObjectKey extends VMStatsLRURegionEntryHea } @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; @@ -271,13 +306,20 @@ public class VMStatsLRURegionEntryHeapObjectKey extends VMStatsLRURegionEntryHea return true; } + + // 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/VMStatsLRURegionEntryHeapStringKey1.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryHeapStringKey1.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryHeapStringKey1.java index 0cd82d7..902a0f2 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryHeapStringKey1.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryHeapStringKey1.java @@ -15,18 +15,26 @@ 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.internal.cache.lru.EnableLRU; + 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.internal.util.concurrent.CustomEntryConcurrentHashMap.HashEntry; // macros whose definition changes this class: // disk: DISK -// lru: LRU -// stats: STATS +// lru: 1 +// stats: 1 // versioned: VERSIONED // offheap: OFFHEAP // One of the following key macros must be defined: @@ -34,17 +42,32 @@ import org.apache.geode.internal.util.concurrent.CustomEntryConcurrentHashMap.Ha // 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). */ public class VMStatsLRURegionEntryHeapStringKey1 extends VMStatsLRURegionEntryHeap { - public VMStatsLRURegionEntryHeapStringKey1(RegionEntryContext context, String key, Object value, - boolean byteEncode) { - super(context, value); + public VMStatsLRURegionEntryHeapStringKey1(RegionEntryContext context, String key, + + + + Object value + + , boolean byteEncode + + ) { + super(context, + + + + value + + ); // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + // caller has already confirmed that key.length <= MAX_INLINE_STRING_KEY long tmpBits1 = 0L; if (byteEncode) { @@ -63,9 +86,11 @@ public class VMStatsLRURegionEntryHeapStringKey1 extends VMStatsLRURegionEntryHe } 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; @@ -73,10 +98,11 @@ public class VMStatsLRURegionEntryHeapStringKey1 extends VMStatsLRURegionEntryHe private volatile long lastModified; private static final AtomicLongFieldUpdater<VMStatsLRURegionEntryHeapStringKey1> lastModifiedUpdater = AtomicLongFieldUpdater.newUpdater(VMStatsLRURegionEntryHeapStringKey1.class, "lastModified"); + private volatile Object value; @Override - protected final Object getValueField() { + protected Object getValueField() { return this.value; } @@ -96,7 +122,7 @@ public class VMStatsLRURegionEntryHeapStringKey1 extends VMStatsLRURegionEntryHe /** * @see HashEntry#getEntryHash() */ - public final int getEntryHash() { + public int getEntryHash() { return this.hash; } @@ -107,117 +133,121 @@ public class VMStatsLRURegionEntryHeapStringKey1 extends VMStatsLRURegionEntryHe /** * @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 + // lru code @Override public void setDelayedDiskId(LocalRegion r) { + + + // nothing needed for LRUs with no disk + } - 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(); @@ -227,7 +257,7 @@ public class VMStatsLRURegionEntryHeapStringKey1 extends VMStatsLRURegionEntryHe } @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); @@ -237,13 +267,14 @@ public class VMStatsLRURegionEntryHeapStringKey1 extends VMStatsLRURegionEntryHe private volatile long lastAccessed; private volatile int hitCount; private volatile int missCount; + private static final AtomicIntegerFieldUpdater<VMStatsLRURegionEntryHeapStringKey1> hitCountUpdater = AtomicIntegerFieldUpdater.newUpdater(VMStatsLRURegionEntryHeapStringKey1.class, "hitCount"); private static final AtomicIntegerFieldUpdater<VMStatsLRURegionEntryHeapStringKey1> missCountUpdater = AtomicIntegerFieldUpdater.newUpdater(VMStatsLRURegionEntryHeapStringKey1.class, "missCount"); @Override - public final long getLastAccessed() throws InternalStatisticsDisabledException { + public long getLastAccessed() throws InternalStatisticsDisabledException { return this.lastAccessed; } @@ -252,12 +283,12 @@ public class VMStatsLRURegionEntryHeapStringKey1 extends VMStatsLRURegionEntryHe } @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; } @@ -270,14 +301,15 @@ public class VMStatsLRURegionEntryHeapStringKey1 extends VMStatsLRURegionEntryHe } @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; @@ -289,8 +321,12 @@ public class VMStatsLRURegionEntryHeapStringKey1 extends VMStatsLRURegionEntryHe return true; } + + // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + // key code + private final long bits1; private int getKeyLength() { @@ -304,7 +340,7 @@ public class VMStatsLRURegionEntryHeapStringKey1 extends VMStatsLRURegionEntryHe } @Override - public final Object getKey() { + public Object getKey() { int keylen = getKeyLength(); char[] chars = new char[keylen]; long tmpBits1 = this.bits1; @@ -323,6 +359,7 @@ public class VMStatsLRURegionEntryHeapStringKey1 extends VMStatsLRURegionEntryHe } // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + @Override public boolean isKeyEqual(Object k) { if (k instanceof String) { @@ -352,5 +389,8 @@ public class VMStatsLRURegionEntryHeapStringKey1 extends VMStatsLRURegionEntryHe } return false; } + + // DO NOT modify this class. It was generated from LeafRegionEntry.cpp } +
