http://git-wip-us.apache.org/repos/asf/geode/blob/a4458531/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryHeapUUIDKey.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryHeapUUIDKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryHeapUUIDKey.java index 4d7c37b..ed4ed05 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryHeapUUIDKey.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryHeapUUIDKey.java @@ -15,43 +15,74 @@ 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.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 +// disk: 1 +// 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 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 VMStatsDiskLRURegionEntryHeapUUIDKey extends VMStatsDiskLRURegionEntryHeap { - public VMStatsDiskLRURegionEntryHeapUUIDKey(RegionEntryContext context, UUID key, Object value) { - super(context, (value instanceof RecoveredEntry ? null : value)); + public VMStatsDiskLRURegionEntryHeapUUIDKey(RegionEntryContext context, UUID key, + + + + 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; @@ -59,10 +90,11 @@ public class VMStatsDiskLRURegionEntryHeapUUIDKey extends VMStatsDiskLRURegionEn private volatile long lastModified; private static final AtomicLongFieldUpdater<VMStatsDiskLRURegionEntryHeapUUIDKey> lastModifiedUpdater = AtomicLongFieldUpdater.newUpdater(VMStatsDiskLRURegionEntryHeapUUIDKey.class, "lastModified"); + private volatile Object value; @Override - protected final Object getValueField() { + protected Object getValueField() { return this.value; } @@ -82,7 +114,7 @@ public class VMStatsDiskLRURegionEntryHeapUUIDKey extends VMStatsDiskLRURegionEn /** * @see HashEntry#getEntryHash() */ - public final int getEntryHash() { + public int getEntryHash() { return this.hash; } @@ -93,19 +125,22 @@ public class VMStatsDiskLRURegionEntryHeapUUIDKey extends VMStatsDiskLRURegionEn /** * @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) { @@ -122,7 +157,7 @@ public class VMStatsDiskLRURegionEntryHeapUUIDKey extends VMStatsDiskLRURegionEn } @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); @@ -130,7 +165,9 @@ public class VMStatsDiskLRURegionEntryHeapUUIDKey extends VMStatsDiskLRURegionEn 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(); @@ -155,7 +192,6 @@ public class VMStatsDiskLRURegionEntryHeapUUIDKey extends VMStatsDiskLRURegionEn void setDiskId(RegionEntry old) { this.id = ((AbstractDiskRegionEntry) old).getDiskId(); } - // // inlining DiskId // // always have these fields // /** @@ -195,108 +231,113 @@ public class VMStatsDiskLRURegionEntryHeapUUIDKey extends VMStatsDiskLRURegionEn // // 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(); @@ -306,7 +347,7 @@ public class VMStatsDiskLRURegionEntryHeapUUIDKey extends VMStatsDiskLRURegionEn } @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); @@ -316,13 +357,14 @@ public class VMStatsDiskLRURegionEntryHeapUUIDKey extends VMStatsDiskLRURegionEn private volatile long lastAccessed; private volatile int hitCount; private volatile int missCount; + private static final AtomicIntegerFieldUpdater<VMStatsDiskLRURegionEntryHeapUUIDKey> hitCountUpdater = AtomicIntegerFieldUpdater.newUpdater(VMStatsDiskLRURegionEntryHeapUUIDKey.class, "hitCount"); private static final AtomicIntegerFieldUpdater<VMStatsDiskLRURegionEntryHeapUUIDKey> missCountUpdater = AtomicIntegerFieldUpdater.newUpdater(VMStatsDiskLRURegionEntryHeapUUIDKey.class, "missCount"); @Override - public final long getLastAccessed() throws InternalStatisticsDisabledException { + public long getLastAccessed() throws InternalStatisticsDisabledException { return this.lastAccessed; } @@ -331,12 +373,12 @@ public class VMStatsDiskLRURegionEntryHeapUUIDKey extends VMStatsDiskLRURegionEn } @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; } @@ -349,14 +391,15 @@ public class VMStatsDiskLRURegionEntryHeapUUIDKey extends VMStatsDiskLRURegionEn } @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; @@ -368,13 +411,17 @@ public class VMStatsDiskLRURegionEntryHeapUUIDKey extends VMStatsDiskLRURegionEn 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); } @@ -387,5 +434,8 @@ public class VMStatsDiskLRURegionEntryHeapUUIDKey extends VMStatsDiskLRURegionEn } 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/VMStatsDiskLRURegionEntryOffHeapIntKey.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryOffHeapIntKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryOffHeapIntKey.java index 856ebc6..9c1fc62 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryOffHeapIntKey.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryOffHeapIntKey.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.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.cache.lru.LRUClockNode; import org.apache.geode.internal.cache.lru.NewLRUClockHand; + 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 +// disk: 1 +// lru: 1 +// 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 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 VMStatsDiskLRURegionEntryOffHeapIntKey extends VMStatsDiskLRURegionEntryOffHeap { public VMStatsDiskLRURegionEntryOffHeapIntKey(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; @@ -63,6 +93,7 @@ public class VMStatsDiskLRURegionEntryOffHeapIntKey extends VMStatsDiskLRURegion private static final AtomicLongFieldUpdater<VMStatsDiskLRURegionEntryOffHeapIntKey> lastModifiedUpdater = AtomicLongFieldUpdater.newUpdater(VMStatsDiskLRURegionEntryOffHeapIntKey.class, "lastModified"); + /** * All access done using ohAddrUpdater so it is used even though the compiler can not tell it is. */ @@ -93,13 +124,19 @@ public class VMStatsDiskLRURegionEntryOffHeapIntKey extends VMStatsDiskLRURegion // 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); } @@ -115,7 +152,9 @@ public class VMStatsDiskLRURegionEntryOffHeapIntKey extends VMStatsDiskLRURegion } @Override + @Released + public void release() { OffHeapRegionEntryHelper.releaseEntry(this); } @@ -139,7 +178,7 @@ public class VMStatsDiskLRURegionEntryOffHeapIntKey extends VMStatsDiskLRURegion /** * @see HashEntry#getEntryHash() */ - public final int getEntryHash() { + public int getEntryHash() { return this.hash; } @@ -150,19 +189,22 @@ public class VMStatsDiskLRURegionEntryOffHeapIntKey extends VMStatsDiskLRURegion /** * @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) { @@ -179,7 +221,7 @@ public class VMStatsDiskLRURegionEntryOffHeapIntKey extends VMStatsDiskLRURegion } @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); @@ -187,7 +229,9 @@ public class VMStatsDiskLRURegionEntryOffHeapIntKey extends VMStatsDiskLRURegion 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(); @@ -212,7 +256,6 @@ public class VMStatsDiskLRURegionEntryOffHeapIntKey extends VMStatsDiskLRURegion void setDiskId(RegionEntry old) { this.id = ((AbstractDiskRegionEntry) old).getDiskId(); } - // // inlining DiskId // // always have these fields // /** @@ -252,108 +295,113 @@ public class VMStatsDiskLRURegionEntryOffHeapIntKey extends VMStatsDiskLRURegion // // 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(); @@ -363,7 +411,7 @@ public class VMStatsDiskLRURegionEntryOffHeapIntKey extends VMStatsDiskLRURegion } @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); @@ -373,6 +421,7 @@ public class VMStatsDiskLRURegionEntryOffHeapIntKey extends VMStatsDiskLRURegion private volatile long lastAccessed; private volatile int hitCount; private volatile int missCount; + private static final AtomicIntegerFieldUpdater<VMStatsDiskLRURegionEntryOffHeapIntKey> hitCountUpdater = AtomicIntegerFieldUpdater.newUpdater(VMStatsDiskLRURegionEntryOffHeapIntKey.class, "hitCount"); @@ -381,7 +430,7 @@ public class VMStatsDiskLRURegionEntryOffHeapIntKey extends VMStatsDiskLRURegion "missCount"); @Override - public final long getLastAccessed() throws InternalStatisticsDisabledException { + public long getLastAccessed() throws InternalStatisticsDisabledException { return this.lastAccessed; } @@ -390,12 +439,12 @@ public class VMStatsDiskLRURegionEntryOffHeapIntKey extends VMStatsDiskLRURegion } @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; } @@ -408,14 +457,15 @@ public class VMStatsDiskLRURegionEntryOffHeapIntKey extends VMStatsDiskLRURegion } @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; @@ -427,12 +477,18 @@ public class VMStatsDiskLRURegionEntryOffHeapIntKey extends VMStatsDiskLRURegion 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; } @@ -443,5 +499,8 @@ public class VMStatsDiskLRURegionEntryOffHeapIntKey extends VMStatsDiskLRURegion } 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/VMStatsDiskLRURegionEntryOffHeapLongKey.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryOffHeapLongKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryOffHeapLongKey.java index 53c24e7..80da3c2 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryOffHeapLongKey.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryOffHeapLongKey.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.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.cache.lru.LRUClockNode; import org.apache.geode.internal.cache.lru.NewLRUClockHand; + 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 +// disk: 1 +// lru: 1 +// 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 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 VMStatsDiskLRURegionEntryOffHeapLongKey extends VMStatsDiskLRURegionEntryOffHeap { public VMStatsDiskLRURegionEntryOffHeapLongKey(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; @@ -63,6 +93,7 @@ public class VMStatsDiskLRURegionEntryOffHeapLongKey extends VMStatsDiskLRURegio private static final AtomicLongFieldUpdater<VMStatsDiskLRURegionEntryOffHeapLongKey> lastModifiedUpdater = AtomicLongFieldUpdater.newUpdater(VMStatsDiskLRURegionEntryOffHeapLongKey.class, "lastModified"); + /** * All access done using ohAddrUpdater so it is used even though the compiler can not tell it is. */ @@ -93,13 +124,19 @@ public class VMStatsDiskLRURegionEntryOffHeapLongKey extends VMStatsDiskLRURegio // 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); } @@ -115,7 +152,9 @@ public class VMStatsDiskLRURegionEntryOffHeapLongKey extends VMStatsDiskLRURegio } @Override + @Released + public void release() { OffHeapRegionEntryHelper.releaseEntry(this); } @@ -139,7 +178,7 @@ public class VMStatsDiskLRURegionEntryOffHeapLongKey extends VMStatsDiskLRURegio /** * @see HashEntry#getEntryHash() */ - public final int getEntryHash() { + public int getEntryHash() { return this.hash; } @@ -150,19 +189,22 @@ public class VMStatsDiskLRURegionEntryOffHeapLongKey extends VMStatsDiskLRURegio /** * @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) { @@ -179,7 +221,7 @@ public class VMStatsDiskLRURegionEntryOffHeapLongKey extends VMStatsDiskLRURegio } @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); @@ -187,7 +229,9 @@ public class VMStatsDiskLRURegionEntryOffHeapLongKey extends VMStatsDiskLRURegio 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(); @@ -212,7 +256,6 @@ public class VMStatsDiskLRURegionEntryOffHeapLongKey extends VMStatsDiskLRURegio void setDiskId(RegionEntry old) { this.id = ((AbstractDiskRegionEntry) old).getDiskId(); } - // // inlining DiskId // // always have these fields // /** @@ -252,108 +295,113 @@ public class VMStatsDiskLRURegionEntryOffHeapLongKey extends VMStatsDiskLRURegio // // 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(); @@ -363,7 +411,7 @@ public class VMStatsDiskLRURegionEntryOffHeapLongKey extends VMStatsDiskLRURegio } @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); @@ -373,6 +421,7 @@ public class VMStatsDiskLRURegionEntryOffHeapLongKey extends VMStatsDiskLRURegio private volatile long lastAccessed; private volatile int hitCount; private volatile int missCount; + private static final AtomicIntegerFieldUpdater<VMStatsDiskLRURegionEntryOffHeapLongKey> hitCountUpdater = AtomicIntegerFieldUpdater.newUpdater(VMStatsDiskLRURegionEntryOffHeapLongKey.class, "hitCount"); @@ -381,7 +430,7 @@ public class VMStatsDiskLRURegionEntryOffHeapLongKey extends VMStatsDiskLRURegio "missCount"); @Override - public final long getLastAccessed() throws InternalStatisticsDisabledException { + public long getLastAccessed() throws InternalStatisticsDisabledException { return this.lastAccessed; } @@ -390,12 +439,12 @@ public class VMStatsDiskLRURegionEntryOffHeapLongKey extends VMStatsDiskLRURegio } @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; } @@ -408,14 +457,15 @@ public class VMStatsDiskLRURegionEntryOffHeapLongKey extends VMStatsDiskLRURegio } @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; @@ -427,12 +477,16 @@ public class VMStatsDiskLRURegionEntryOffHeapLongKey extends VMStatsDiskLRURegio 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; } @@ -443,5 +497,8 @@ public class VMStatsDiskLRURegionEntryOffHeapLongKey extends VMStatsDiskLRURegio } 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/VMStatsDiskLRURegionEntryOffHeapObjectKey.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryOffHeapObjectKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryOffHeapObjectKey.java index 816c0aa..3148438 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryOffHeapObjectKey.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryOffHeapObjectKey.java @@ -15,46 +15,75 @@ 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.cache.lru.LRUClockNode; import org.apache.geode.internal.cache.lru.NewLRUClockHand; + 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 +// disk: 1 +// lru: 1 +// 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 VMStatsDiskLRURegionEntryOffHeapObjectKey extends VMStatsDiskLRURegionEntryOffHeap { public VMStatsDiskLRURegionEntryOffHeapObjectKey(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; @@ -63,6 +92,7 @@ public class VMStatsDiskLRURegionEntryOffHeapObjectKey extends VMStatsDiskLRUReg private static final AtomicLongFieldUpdater<VMStatsDiskLRURegionEntryOffHeapObjectKey> lastModifiedUpdater = AtomicLongFieldUpdater.newUpdater(VMStatsDiskLRURegionEntryOffHeapObjectKey.class, "lastModified"); + /** * All access done using ohAddrUpdater so it is used even though the compiler can not tell it is. */ @@ -94,13 +124,19 @@ public class VMStatsDiskLRURegionEntryOffHeapObjectKey extends VMStatsDiskLRUReg // 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); } @@ -116,7 +152,9 @@ public class VMStatsDiskLRURegionEntryOffHeapObjectKey extends VMStatsDiskLRUReg } @Override + @Released + public void release() { OffHeapRegionEntryHelper.releaseEntry(this); } @@ -140,7 +178,7 @@ public class VMStatsDiskLRURegionEntryOffHeapObjectKey extends VMStatsDiskLRUReg /** * @see HashEntry#getEntryHash() */ - public final int getEntryHash() { + public int getEntryHash() { return this.hash; } @@ -151,19 +189,22 @@ public class VMStatsDiskLRURegionEntryOffHeapObjectKey extends VMStatsDiskLRUReg /** * @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) { @@ -180,7 +221,7 @@ public class VMStatsDiskLRURegionEntryOffHeapObjectKey extends VMStatsDiskLRUReg } @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); @@ -188,7 +229,9 @@ public class VMStatsDiskLRURegionEntryOffHeapObjectKey extends VMStatsDiskLRUReg 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(); @@ -213,7 +256,6 @@ public class VMStatsDiskLRURegionEntryOffHeapObjectKey extends VMStatsDiskLRUReg void setDiskId(RegionEntry old) { this.id = ((AbstractDiskRegionEntry) old).getDiskId(); } - // // inlining DiskId // // always have these fields // /** @@ -253,108 +295,113 @@ public class VMStatsDiskLRURegionEntryOffHeapObjectKey extends VMStatsDiskLRUReg // // 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(); @@ -364,7 +411,7 @@ public class VMStatsDiskLRURegionEntryOffHeapObjectKey extends VMStatsDiskLRUReg } @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); @@ -374,6 +421,7 @@ public class VMStatsDiskLRURegionEntryOffHeapObjectKey extends VMStatsDiskLRUReg private volatile long lastAccessed; private volatile int hitCount; private volatile int missCount; + private static final AtomicIntegerFieldUpdater<VMStatsDiskLRURegionEntryOffHeapObjectKey> hitCountUpdater = AtomicIntegerFieldUpdater.newUpdater(VMStatsDiskLRURegionEntryOffHeapObjectKey.class, "hitCount"); @@ -382,7 +430,7 @@ public class VMStatsDiskLRURegionEntryOffHeapObjectKey extends VMStatsDiskLRUReg "missCount"); @Override - public final long getLastAccessed() throws InternalStatisticsDisabledException { + public long getLastAccessed() throws InternalStatisticsDisabledException { return this.lastAccessed; } @@ -391,12 +439,12 @@ public class VMStatsDiskLRURegionEntryOffHeapObjectKey extends VMStatsDiskLRUReg } @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; } @@ -409,14 +457,15 @@ public class VMStatsDiskLRURegionEntryOffHeapObjectKey extends VMStatsDiskLRUReg } @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; @@ -428,13 +477,20 @@ public class VMStatsDiskLRURegionEntryOffHeapObjectKey extends VMStatsDiskLRUReg 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/VMStatsDiskLRURegionEntryOffHeapStringKey1.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryOffHeapStringKey1.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryOffHeapStringKey1.java index 74facf4..9d0794e 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryOffHeapStringKey1.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryOffHeapStringKey1.java @@ -15,42 +15,68 @@ 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.cache.lru.LRUClockNode; import org.apache.geode.internal.cache.lru.NewLRUClockHand; + 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 +// disk: 1 +// lru: 1 +// 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 VMStatsDiskLRURegionEntryOffHeapStringKey1 extends VMStatsDiskLRURegionEntryOffHeap { public VMStatsDiskLRURegionEntryOffHeapStringKey1(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) { @@ -69,9 +95,11 @@ public class VMStatsDiskLRURegionEntryOffHeapStringKey1 extends VMStatsDiskLRURe } 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; @@ -80,6 +108,7 @@ public class VMStatsDiskLRURegionEntryOffHeapStringKey1 extends VMStatsDiskLRURe private static final AtomicLongFieldUpdater<VMStatsDiskLRURegionEntryOffHeapStringKey1> lastModifiedUpdater = AtomicLongFieldUpdater.newUpdater(VMStatsDiskLRURegionEntryOffHeapStringKey1.class, "lastModified"); + /** * All access done using ohAddrUpdater so it is used even though the compiler can not tell it is. */ @@ -111,13 +140,19 @@ public class VMStatsDiskLRURegionEntryOffHeapStringKey1 extends VMStatsDiskLRURe // 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); } @@ -133,7 +168,9 @@ public class VMStatsDiskLRURegionEntryOffHeapStringKey1 extends VMStatsDiskLRURe } @Override + @Released + public void release() { OffHeapRegionEntryHelper.releaseEntry(this); } @@ -157,7 +194,7 @@ public class VMStatsDiskLRURegionEntryOffHeapStringKey1 extends VMStatsDiskLRURe /** * @see HashEntry#getEntryHash() */ - public final int getEntryHash() { + public int getEntryHash() { return this.hash; } @@ -168,19 +205,22 @@ public class VMStatsDiskLRURegionEntryOffHeapStringKey1 extends VMStatsDiskLRURe /** * @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) { @@ -197,7 +237,7 @@ public class VMStatsDiskLRURegionEntryOffHeapStringKey1 extends VMStatsDiskLRURe } @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); @@ -205,7 +245,9 @@ public class VMStatsDiskLRURegionEntryOffHeapStringKey1 extends VMStatsDiskLRURe 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(); @@ -230,7 +272,6 @@ public class VMStatsDiskLRURegionEntryOffHeapStringKey1 extends VMStatsDiskLRURe void setDiskId(RegionEntry old) { this.id = ((AbstractDiskRegionEntry) old).getDiskId(); } - // // inlining DiskId // // always have these fields // /** @@ -270,108 +311,113 @@ public class VMStatsDiskLRURegionEntryOffHeapStringKey1 extends VMStatsDiskLRURe // // 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(); @@ -381,7 +427,7 @@ public class VMStatsDiskLRURegionEntryOffHeapStringKey1 extends VMStatsDiskLRURe } @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); @@ -391,6 +437,7 @@ public class VMStatsDiskLRURegionEntryOffHeapStringKey1 extends VMStatsDiskLRURe private volatile long lastAccessed; private volatile int hitCount; private volatile int missCount; + private static final AtomicIntegerFieldUpdater<VMStatsDiskLRURegionEntryOffHeapStringKey1> hitCountUpdater = AtomicIntegerFieldUpdater.newUpdater(VMStatsDiskLRURegionEntryOffHeapStringKey1.class, "hitCount"); @@ -399,7 +446,7 @@ public class VMStatsDiskLRURegionEntryOffHeapStringKey1 extends VMStatsDiskLRURe "missCount"); @Override - public final long getLastAccessed() throws InternalStatisticsDisabledException { + public long getLastAccessed() throws InternalStatisticsDisabledException { return this.lastAccessed; } @@ -408,12 +455,12 @@ public class VMStatsDiskLRURegionEntryOffHeapStringKey1 extends VMStatsDiskLRURe } @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; } @@ -426,14 +473,15 @@ public class VMStatsDiskLRURegionEntryOffHeapStringKey1 extends VMStatsDiskLRURe } @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; @@ -445,8 +493,12 @@ public class VMStatsDiskLRURegionEntryOffHeapStringKey1 extends VMStatsDiskLRURe return true; } + + // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + // key code + private final long bits1; private int getKeyLength() { @@ -460,7 +512,7 @@ public class VMStatsDiskLRURegionEntryOffHeapStringKey1 extends VMStatsDiskLRURe } @Override - public final Object getKey() { + public Object getKey() { int keylen = getKeyLength(); char[] chars = new char[keylen]; long tmpBits1 = this.bits1; @@ -479,6 +531,7 @@ public class VMStatsDiskLRURegionEntryOffHeapStringKey1 extends VMStatsDiskLRURe } // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + @Override public boolean isKeyEqual(Object k) { if (k instanceof String) { @@ -508,5 +561,8 @@ public class VMStatsDiskLRURegionEntryOffHeapStringKey1 extends VMStatsDiskLRURe } 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/VMStatsDiskLRURegionEntryOffHeapStringKey2.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryOffHeapStringKey2.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryOffHeapStringKey2.java index 653e4a5..93cff9c 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryOffHeapStringKey2.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskLRURegionEntryOffHeapStringKey2.java @@ -15,42 +15,68 @@ 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.cache.lru.LRUClockNode; import org.apache.geode.internal.cache.lru.NewLRUClockHand; + 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 +// disk: 1 +// lru: 1 +// 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 VMStatsDiskLRURegionEntryOffHeapStringKey2 extends VMStatsDiskLRURegionEntryOffHeap { public VMStatsDiskLRURegionEntryOffHeapStringKey2(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; @@ -81,9 +107,11 @@ public class VMStatsDiskLRURegionEntryOffHeapStringKey2 extends VMStatsDiskLRURe 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; @@ -92,6 +120,7 @@ public class VMStatsDiskLRURegionEntryOffHeapStringKey2 extends VMStatsDiskLRURe private static final AtomicLongFieldUpdater<VMStatsDiskLRURegionEntryOffHeapStringKey2> lastModifiedUpdater = AtomicLongFieldUpdater.newUpdater(VMStatsDiskLRURegionEntryOffHeapStringKey2.class, "lastModified"); + /** * All access done using ohAddrUpdater so it is used even though the compiler can not tell it is. */ @@ -123,13 +152,19 @@ public class VMStatsDiskLRURegionEntryOffHeapStringKey2 extends VMStatsDiskLRURe // 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); } @@ -145,7 +180,9 @@ public class VMStatsDiskLRURegionEntryOffHeapStringKey2 extends VMStatsDiskLRURe } @Override + @Released + public void release() { OffHeapRegionEntryHelper.releaseEntry(this); } @@ -169,7 +206,7 @@ public class VMStatsDiskLRURegionEntryOffHeapStringKey2 extends VMStatsDiskLRURe /** * @see HashEntry#getEntryHash() */ - public final int getEntryHash() { + public int getEntryHash() { return this.hash; } @@ -180,19 +217,22 @@ public class VMStatsDiskLRURegionEntryOffHeapStringKey2 extends VMStatsDiskLRURe /** * @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) { @@ -209,7 +249,7 @@ public class VMStatsDiskLRURegionEntryOffHeapStringKey2 extends VMStatsDiskLRURe } @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); @@ -217,7 +257,9 @@ public class VMStatsDiskLRURegionEntryOffHeapStringKey2 extends VMStatsDiskLRURe 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(); @@ -242,7 +284,6 @@ public class VMStatsDiskLRURegionEntryOffHeapStringKey2 extends VMStatsDiskLRURe void setDiskId(RegionEntry old) { this.id = ((AbstractDiskRegionEntry) old).getDiskId(); } - // // inlining DiskId // // always have these fields // /** @@ -282,108 +323,113 @@ public class VMStatsDiskLRURegionEntryOffHeapStringKey2 extends VMStatsDiskLRURe // // 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(); @@ -393,7 +439,7 @@ public class VMStatsDiskLRURegionEntryOffHeapStringKey2 extends VMStatsDiskLRURe } @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); @@ -403,6 +449,7 @@ public class VMStatsDiskLRURegionEntryOffHeapStringKey2 extends VMStatsDiskLRURe private volatile long lastAccessed; private volatile int hitCount; private volatile int missCount; + private static final AtomicIntegerFieldUpdater<VMStatsDiskLRURegionEntryOffHeapStringKey2> hitCountUpdater = AtomicIntegerFieldUpdater.newUpdater(VMStatsDiskLRURegionEntryOffHeapStringKey2.class, "hitCount"); @@ -411,7 +458,7 @@ public class VMStatsDiskLRURegionEntryOffHeapStringKey2 extends VMStatsDiskLRURe "missCount"); @Override - public final long getLastAccessed() throws InternalStatisticsDisabledException { + public long getLastAccessed() throws InternalStatisticsDisabledException { return this.lastAccessed; } @@ -420,12 +467,12 @@ public class VMStatsDiskLRURegionEntryOffHeapStringKey2 extends VMStatsDiskLRURe } @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; } @@ -438,14 +485,15 @@ public class VMStatsDiskLRURegionEntryOffHeapStringKey2 extends VMStatsDiskLRURe } @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; @@ -457,8 +505,12 @@ public class VMStatsDiskLRURegionEntryOffHeapStringKey2 extends VMStatsDiskLRURe 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. @@ -477,7 +529,7 @@ public class VMStatsDiskLRURegionEntryOffHeapStringKey2 extends VMStatsDiskLRURe } @Override - public final Object getKey() { + public Object getKey() { int keylen = getKeyLength(); char[] chars = new char[keylen]; long tmpBits1 = this.bits1; @@ -507,6 +559,7 @@ public class VMStatsDiskLRURegionEntryOffHeapStringKey2 extends VMStatsDiskLRURe } // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + @Override public boolean isKeyEqual(Object k) { if (k instanceof String) { @@ -549,5 +602,7 @@ public class VMStatsDiskLRURegionEntryOffHeapStringKey2 extends VMStatsDiskLRURe } return false; } + // DO NOT modify this class. It was generated from LeafRegionEntry.cpp } +
