http://git-wip-us.apache.org/repos/asf/geode/blob/d4f23332/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryHeapIntKey.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryHeapIntKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryHeapIntKey.java index de8ecb4..0bd4f47 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryHeapIntKey.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryHeapIntKey.java @@ -15,84 +15,116 @@ 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.util.concurrent.CustomEntryConcurrentHashMap.HashEntry; // macros whose definition changes this class: -// disk: DISK +// disk: 1 // lru: LRU -// stats: STATS +// 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 VMStatsDiskRegionEntryHeapIntKey extends VMStatsDiskRegionEntryHeap { - public VMStatsDiskRegionEntryHeapIntKey(RegionEntryContext context, int key, Object value) { - super(context, (value instanceof RecoveredEntry ? null : value)); + public VMStatsDiskRegionEntryHeapIntKey (RegionEntryContext context, int 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.key = key; + } // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + // common code protected int hash; private HashEntry<Object, Object> next; @SuppressWarnings("unused") private volatile long lastModified; - private static final AtomicLongFieldUpdater<VMStatsDiskRegionEntryHeapIntKey> lastModifiedUpdater = - AtomicLongFieldUpdater.newUpdater(VMStatsDiskRegionEntryHeapIntKey.class, "lastModified"); - private volatile Object value; + private static final AtomicLongFieldUpdater<VMStatsDiskRegionEntryHeapIntKey> lastModifiedUpdater + = AtomicLongFieldUpdater.newUpdater(VMStatsDiskRegionEntryHeapIntKey.class, "lastModified"); + private volatile Object value; @Override protected final Object getValueField() { return this.value; } - @Override protected void setValueField(Object v) { this.value = v; } - protected long getlastModifiedField() { + protected long getLastModifiedField() { return lastModifiedUpdater.get(this); } - protected boolean compareAndSetLastModifiedField(long expectedValue, long newValue) { return lastModifiedUpdater.compareAndSet(this, expectedValue, newValue); } - /** * @see HashEntry#getEntryHash() */ public final int getEntryHash() { return this.hash; } - protected void setEntryHash(int v) { this.hash = v; } - /** * @see HashEntry#getNextEntry() */ public final HashEntry<Object, Object> getNextEntry() { return this.next; } - /** * @see HashEntry#setNextEntry */ @@ -100,23 +132,27 @@ public class VMStatsDiskRegionEntryHeapIntKey extends VMStatsDiskRegionEntryHeap this.next = n; } + // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + // disk code + protected void initialize(RegionEntryContext context, Object value) { diskInitialize(context, value); } - @Override public int updateAsyncEntrySize(EnableLRU capacityController) { throw new IllegalStateException("should never be called"); } + // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + private void diskInitialize(RegionEntryContext context, Object value) { - DiskRecoveryStore drs = (DiskRecoveryStore) context; + DiskRecoveryStore drs = (DiskRecoveryStore)context; DiskStoreImpl ds = drs.getDiskStore(); long maxOplogSize = ds.getMaxOplogSize(); - // get appropriate instance of DiskId implementation based on maxOplogSize + //get appropriate instance of DiskId implementation based on maxOplogSize this.id = DiskId.createDiskId(maxOplogSize, true/* is persistence */, ds.needsLinkedList()); Helper.initialize(this, drs, value); } @@ -126,60 +162,64 @@ public class VMStatsDiskRegionEntryHeapIntKey extends VMStatsDiskRegionEntryHeap * * @since GemFire 5.1 */ - protected DiskId id;// = new DiskId(); - + protected DiskId id;//= new DiskId(); public DiskId getDiskId() { return this.id; } - @Override void setDiskId(RegionEntry old) { - this.id = ((AbstractDiskRegionEntry) old).getDiskId(); + this.id = ((AbstractDiskRegionEntry)old).getDiskId(); } +// // inlining DiskId +// // always have these fields +// /** +// * id consists of +// * most significant +// * 1 byte = users bits +// * 2-8 bytes = oplog id +// * least significant. +// * +// * The highest bit in the oplog id part is set to 1 if the oplog id +// * is negative. +// * @todo this field could be an int for an overflow only region +// */ +// private long id; +// /** +// * Length of the bytes on disk. +// * This is always set. If the value is invalid then it will be set to 0. +// * The most significant bit is used by overflow to mark it as needing to be written. +// */ +// protected int valueLength = 0; +// // have intOffset or longOffset +// // intOffset +// /** +// * The position in the oplog (the oplog offset) where this entry's value is +// * stored +// */ +// private volatile int offsetInOplog; +// // longOffset +// /** +// * The position in the oplog (the oplog offset) where this entry's value is +// * stored +// */ +// private volatile long offsetInOplog; +// // have overflowOnly or persistence +// // overflowOnly +// // no fields +// // persistent +// /** unique entry identifier * */ +// private long keyId; + + + + - // // inlining DiskId - // // always have these fields - // /** - // * id consists of - // * most significant - // * 1 byte = users bits - // * 2-8 bytes = oplog id - // * least significant. - // * - // * The highest bit in the oplog id part is set to 1 if the oplog id - // * is negative. - // * @todo this field could be an int for an overflow only region - // */ - // private long id; - // /** - // * Length of the bytes on disk. - // * This is always set. If the value is invalid then it will be set to 0. - // * The most significant bit is used by overflow to mark it as needing to be written. - // */ - // protected int valueLength = 0; - // // have intOffset or longOffset - // // intOffset - // /** - // * The position in the oplog (the oplog offset) where this entry's value is - // * stored - // */ - // private volatile int offsetInOplog; - // // longOffset - // /** - // * The position in the oplog (the oplog offset) where this entry's value is - // * stored - // */ - // private volatile long offsetInOplog; - // // have overflowOnly or persistence - // // overflowOnly - // // no fields - // // 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 final void updateStatsForGet(boolean hit, long time) + { setLastAccessed(time); if (hit) { incrementHitCount(); @@ -187,57 +227,51 @@ public class VMStatsDiskRegionEntryHeapIntKey extends VMStatsDiskRegionEntryHeap incrementMissCount(); } } - @Override protected final void setLastModifiedAndAccessedTimes(long lastModified, long lastAccessed) { _setLastModified(lastModified); - if (!DISABLE_ACCESS_TIME_UPDATE_ON_PUT) { + if (!DISABLE_ACCESS_TIME_UPDATE_ON_PUT) { setLastAccessed(lastAccessed); } } - private volatile long lastAccessed; private volatile int hitCount; private volatile int missCount; - private static final AtomicIntegerFieldUpdater<VMStatsDiskRegionEntryHeapIntKey> hitCountUpdater = - AtomicIntegerFieldUpdater.newUpdater(VMStatsDiskRegionEntryHeapIntKey.class, "hitCount"); - private static final AtomicIntegerFieldUpdater<VMStatsDiskRegionEntryHeapIntKey> missCountUpdater = - AtomicIntegerFieldUpdater.newUpdater(VMStatsDiskRegionEntryHeapIntKey.class, "missCount"); - + + private static final AtomicIntegerFieldUpdater<VMStatsDiskRegionEntryHeapIntKey> hitCountUpdater + = AtomicIntegerFieldUpdater.newUpdater(VMStatsDiskRegionEntryHeapIntKey.class, "hitCount"); + private static final AtomicIntegerFieldUpdater<VMStatsDiskRegionEntryHeapIntKey> missCountUpdater + = AtomicIntegerFieldUpdater.newUpdater(VMStatsDiskRegionEntryHeapIntKey.class, "missCount"); + @Override public final long getLastAccessed() throws InternalStatisticsDisabledException { return this.lastAccessed; } - private void setLastAccessed(long lastAccessed) { this.lastAccessed = lastAccessed; } - @Override public final long getHitCount() throws InternalStatisticsDisabledException { return this.hitCount & 0xFFFFFFFFL; } - @Override public final long getMissCount() throws InternalStatisticsDisabledException { return this.missCount & 0xFFFFFFFFL; } - private void incrementHitCount() { hitCountUpdater.incrementAndGet(this); } - private void incrementMissCount() { missCountUpdater.incrementAndGet(this); } - @Override public final void resetCounts() throws InternalStatisticsDisabledException { - hitCountUpdater.set(this, 0); - missCountUpdater.set(this, 0); + 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) { setLastModified(currTime); @@ -245,21 +279,30 @@ public class VMStatsDiskRegionEntryHeapIntKey extends VMStatsDiskRegionEntryHeap this.hitCount = 0; this.missCount = 0; } - @Override public boolean hasStats() { return true; } + + + // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + // key code - private final int key; + + + + + + + + private final int key; @Override public final Object getKey() { return this.key; } - @Override public boolean isKeyEqual(Object k) { if (k instanceof Integer) { @@ -267,5 +310,8 @@ public class VMStatsDiskRegionEntryHeapIntKey extends VMStatsDiskRegionEntryHeap } return false; } + + // DO NOT modify this class. It was generated from LeafRegionEntry.cpp } +
http://git-wip-us.apache.org/repos/asf/geode/blob/d4f23332/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryHeapLongKey.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryHeapLongKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryHeapLongKey.java index 3b57a84..ac99938 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryHeapLongKey.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryHeapLongKey.java @@ -15,84 +15,118 @@ 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.util.concurrent.CustomEntryConcurrentHashMap.HashEntry; // macros whose definition changes this class: -// disk: DISK +// disk: 1 // lru: LRU -// stats: STATS +// 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 VMStatsDiskRegionEntryHeapLongKey extends VMStatsDiskRegionEntryHeap { - public VMStatsDiskRegionEntryHeapLongKey(RegionEntryContext context, long key, Object value) { - super(context, (value instanceof RecoveredEntry ? null : value)); + public VMStatsDiskRegionEntryHeapLongKey (RegionEntryContext context, long 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.key = key; + } // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + // common code protected int hash; private HashEntry<Object, Object> next; @SuppressWarnings("unused") private volatile long lastModified; - private static final AtomicLongFieldUpdater<VMStatsDiskRegionEntryHeapLongKey> lastModifiedUpdater = - AtomicLongFieldUpdater.newUpdater(VMStatsDiskRegionEntryHeapLongKey.class, "lastModified"); - private volatile Object value; + private static final AtomicLongFieldUpdater<VMStatsDiskRegionEntryHeapLongKey> lastModifiedUpdater + = AtomicLongFieldUpdater.newUpdater(VMStatsDiskRegionEntryHeapLongKey.class, "lastModified"); + private volatile Object value; @Override protected final Object getValueField() { return this.value; } - @Override protected void setValueField(Object v) { this.value = v; } - protected long getlastModifiedField() { + protected long getLastModifiedField() { return lastModifiedUpdater.get(this); } - protected boolean compareAndSetLastModifiedField(long expectedValue, long newValue) { return lastModifiedUpdater.compareAndSet(this, expectedValue, newValue); } - /** * @see HashEntry#getEntryHash() */ public final int getEntryHash() { return this.hash; } - protected void setEntryHash(int v) { this.hash = v; } - /** * @see HashEntry#getNextEntry() */ public final HashEntry<Object, Object> getNextEntry() { return this.next; } - /** * @see HashEntry#setNextEntry */ @@ -100,23 +134,27 @@ public class VMStatsDiskRegionEntryHeapLongKey extends VMStatsDiskRegionEntryHea this.next = n; } + // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + // disk code + protected void initialize(RegionEntryContext context, Object value) { diskInitialize(context, value); } - @Override public int updateAsyncEntrySize(EnableLRU capacityController) { throw new IllegalStateException("should never be called"); } + // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + private void diskInitialize(RegionEntryContext context, Object value) { - DiskRecoveryStore drs = (DiskRecoveryStore) context; + DiskRecoveryStore drs = (DiskRecoveryStore)context; DiskStoreImpl ds = drs.getDiskStore(); long maxOplogSize = ds.getMaxOplogSize(); - // get appropriate instance of DiskId implementation based on maxOplogSize + //get appropriate instance of DiskId implementation based on maxOplogSize this.id = DiskId.createDiskId(maxOplogSize, true/* is persistence */, ds.needsLinkedList()); Helper.initialize(this, drs, value); } @@ -126,60 +164,64 @@ public class VMStatsDiskRegionEntryHeapLongKey extends VMStatsDiskRegionEntryHea * * @since GemFire 5.1 */ - protected DiskId id;// = new DiskId(); - + protected DiskId id;//= new DiskId(); public DiskId getDiskId() { return this.id; } - @Override void setDiskId(RegionEntry old) { - this.id = ((AbstractDiskRegionEntry) old).getDiskId(); + this.id = ((AbstractDiskRegionEntry)old).getDiskId(); } +// // inlining DiskId +// // always have these fields +// /** +// * id consists of +// * most significant +// * 1 byte = users bits +// * 2-8 bytes = oplog id +// * least significant. +// * +// * The highest bit in the oplog id part is set to 1 if the oplog id +// * is negative. +// * @todo this field could be an int for an overflow only region +// */ +// private long id; +// /** +// * Length of the bytes on disk. +// * This is always set. If the value is invalid then it will be set to 0. +// * The most significant bit is used by overflow to mark it as needing to be written. +// */ +// protected int valueLength = 0; +// // have intOffset or longOffset +// // intOffset +// /** +// * The position in the oplog (the oplog offset) where this entry's value is +// * stored +// */ +// private volatile int offsetInOplog; +// // longOffset +// /** +// * The position in the oplog (the oplog offset) where this entry's value is +// * stored +// */ +// private volatile long offsetInOplog; +// // have overflowOnly or persistence +// // overflowOnly +// // no fields +// // persistent +// /** unique entry identifier * */ +// private long keyId; + + + + - // // inlining DiskId - // // always have these fields - // /** - // * id consists of - // * most significant - // * 1 byte = users bits - // * 2-8 bytes = oplog id - // * least significant. - // * - // * The highest bit in the oplog id part is set to 1 if the oplog id - // * is negative. - // * @todo this field could be an int for an overflow only region - // */ - // private long id; - // /** - // * Length of the bytes on disk. - // * This is always set. If the value is invalid then it will be set to 0. - // * The most significant bit is used by overflow to mark it as needing to be written. - // */ - // protected int valueLength = 0; - // // have intOffset or longOffset - // // intOffset - // /** - // * The position in the oplog (the oplog offset) where this entry's value is - // * stored - // */ - // private volatile int offsetInOplog; - // // longOffset - // /** - // * The position in the oplog (the oplog offset) where this entry's value is - // * stored - // */ - // private volatile long offsetInOplog; - // // have overflowOnly or persistence - // // overflowOnly - // // no fields - // // 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 final void updateStatsForGet(boolean hit, long time) + { setLastAccessed(time); if (hit) { incrementHitCount(); @@ -187,57 +229,51 @@ public class VMStatsDiskRegionEntryHeapLongKey extends VMStatsDiskRegionEntryHea incrementMissCount(); } } - @Override protected final void setLastModifiedAndAccessedTimes(long lastModified, long lastAccessed) { _setLastModified(lastModified); - if (!DISABLE_ACCESS_TIME_UPDATE_ON_PUT) { + if (!DISABLE_ACCESS_TIME_UPDATE_ON_PUT) { setLastAccessed(lastAccessed); } } - private volatile long lastAccessed; private volatile int hitCount; private volatile int missCount; - private static final AtomicIntegerFieldUpdater<VMStatsDiskRegionEntryHeapLongKey> hitCountUpdater = - AtomicIntegerFieldUpdater.newUpdater(VMStatsDiskRegionEntryHeapLongKey.class, "hitCount"); - private static final AtomicIntegerFieldUpdater<VMStatsDiskRegionEntryHeapLongKey> missCountUpdater = - AtomicIntegerFieldUpdater.newUpdater(VMStatsDiskRegionEntryHeapLongKey.class, "missCount"); - + + private static final AtomicIntegerFieldUpdater<VMStatsDiskRegionEntryHeapLongKey> hitCountUpdater + = AtomicIntegerFieldUpdater.newUpdater(VMStatsDiskRegionEntryHeapLongKey.class, "hitCount"); + private static final AtomicIntegerFieldUpdater<VMStatsDiskRegionEntryHeapLongKey> missCountUpdater + = AtomicIntegerFieldUpdater.newUpdater(VMStatsDiskRegionEntryHeapLongKey.class, "missCount"); + @Override public final long getLastAccessed() throws InternalStatisticsDisabledException { return this.lastAccessed; } - private void setLastAccessed(long lastAccessed) { this.lastAccessed = lastAccessed; } - @Override public final long getHitCount() throws InternalStatisticsDisabledException { return this.hitCount & 0xFFFFFFFFL; } - @Override public final long getMissCount() throws InternalStatisticsDisabledException { return this.missCount & 0xFFFFFFFFL; } - private void incrementHitCount() { hitCountUpdater.incrementAndGet(this); } - private void incrementMissCount() { missCountUpdater.incrementAndGet(this); } - @Override public final void resetCounts() throws InternalStatisticsDisabledException { - hitCountUpdater.set(this, 0); - missCountUpdater.set(this, 0); + 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) { setLastModified(currTime); @@ -245,21 +281,23 @@ public class VMStatsDiskRegionEntryHeapLongKey extends VMStatsDiskRegionEntryHea this.hitCount = 0; this.missCount = 0; } - @Override public boolean hasStats() { return true; } + + + // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + // key code - private final long key; + private final long key; @Override public final Object getKey() { return this.key; } - @Override public boolean isKeyEqual(Object k) { if (k instanceof Long) { @@ -267,5 +305,8 @@ public class VMStatsDiskRegionEntryHeapLongKey extends VMStatsDiskRegionEntryHea } return false; } + + // DO NOT modify this class. It was generated from LeafRegionEntry.cpp } + http://git-wip-us.apache.org/repos/asf/geode/blob/d4f23332/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryHeapObjectKey.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryHeapObjectKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryHeapObjectKey.java index a9f91b9..7dbe3a1 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryHeapObjectKey.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryHeapObjectKey.java @@ -15,84 +15,114 @@ 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.util.concurrent.CustomEntryConcurrentHashMap.HashEntry; // macros whose definition changes this class: -// disk: DISK +// disk: 1 // lru: LRU -// stats: STATS +// 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 VMStatsDiskRegionEntryHeapObjectKey extends VMStatsDiskRegionEntryHeap { - public VMStatsDiskRegionEntryHeapObjectKey(RegionEntryContext context, Object key, Object value) { - super(context, (value instanceof RecoveredEntry ? null : value)); + public VMStatsDiskRegionEntryHeapObjectKey (RegionEntryContext context, Object 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.key = key; + } // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + // common code protected int hash; private HashEntry<Object, Object> next; @SuppressWarnings("unused") private volatile long lastModified; - private static final AtomicLongFieldUpdater<VMStatsDiskRegionEntryHeapObjectKey> lastModifiedUpdater = - AtomicLongFieldUpdater.newUpdater(VMStatsDiskRegionEntryHeapObjectKey.class, "lastModified"); - private volatile Object value; + private static final AtomicLongFieldUpdater<VMStatsDiskRegionEntryHeapObjectKey> lastModifiedUpdater + = AtomicLongFieldUpdater.newUpdater(VMStatsDiskRegionEntryHeapObjectKey.class, "lastModified"); + private volatile Object value; @Override protected final Object getValueField() { return this.value; } - @Override protected void setValueField(Object v) { this.value = v; } - protected long getlastModifiedField() { + protected long getLastModifiedField() { return lastModifiedUpdater.get(this); } - protected boolean compareAndSetLastModifiedField(long expectedValue, long newValue) { return lastModifiedUpdater.compareAndSet(this, expectedValue, newValue); } - /** * @see HashEntry#getEntryHash() */ public final int getEntryHash() { return this.hash; } - protected void setEntryHash(int v) { this.hash = v; } - /** * @see HashEntry#getNextEntry() */ public final HashEntry<Object, Object> getNextEntry() { return this.next; } - /** * @see HashEntry#setNextEntry */ @@ -100,23 +130,27 @@ public class VMStatsDiskRegionEntryHeapObjectKey extends VMStatsDiskRegionEntryH this.next = n; } + // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + // disk code + protected void initialize(RegionEntryContext context, Object value) { diskInitialize(context, value); } - @Override public int updateAsyncEntrySize(EnableLRU capacityController) { throw new IllegalStateException("should never be called"); } + // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + private void diskInitialize(RegionEntryContext context, Object value) { - DiskRecoveryStore drs = (DiskRecoveryStore) context; + DiskRecoveryStore drs = (DiskRecoveryStore)context; DiskStoreImpl ds = drs.getDiskStore(); long maxOplogSize = ds.getMaxOplogSize(); - // get appropriate instance of DiskId implementation based on maxOplogSize + //get appropriate instance of DiskId implementation based on maxOplogSize this.id = DiskId.createDiskId(maxOplogSize, true/* is persistence */, ds.needsLinkedList()); Helper.initialize(this, drs, value); } @@ -126,60 +160,64 @@ public class VMStatsDiskRegionEntryHeapObjectKey extends VMStatsDiskRegionEntryH * * @since GemFire 5.1 */ - protected DiskId id;// = new DiskId(); - + protected DiskId id;//= new DiskId(); public DiskId getDiskId() { return this.id; } - @Override void setDiskId(RegionEntry old) { - this.id = ((AbstractDiskRegionEntry) old).getDiskId(); + this.id = ((AbstractDiskRegionEntry)old).getDiskId(); } +// // inlining DiskId +// // always have these fields +// /** +// * id consists of +// * most significant +// * 1 byte = users bits +// * 2-8 bytes = oplog id +// * least significant. +// * +// * The highest bit in the oplog id part is set to 1 if the oplog id +// * is negative. +// * @todo this field could be an int for an overflow only region +// */ +// private long id; +// /** +// * Length of the bytes on disk. +// * This is always set. If the value is invalid then it will be set to 0. +// * The most significant bit is used by overflow to mark it as needing to be written. +// */ +// protected int valueLength = 0; +// // have intOffset or longOffset +// // intOffset +// /** +// * The position in the oplog (the oplog offset) where this entry's value is +// * stored +// */ +// private volatile int offsetInOplog; +// // longOffset +// /** +// * The position in the oplog (the oplog offset) where this entry's value is +// * stored +// */ +// private volatile long offsetInOplog; +// // have overflowOnly or persistence +// // overflowOnly +// // no fields +// // persistent +// /** unique entry identifier * */ +// private long keyId; + + + + - // // inlining DiskId - // // always have these fields - // /** - // * id consists of - // * most significant - // * 1 byte = users bits - // * 2-8 bytes = oplog id - // * least significant. - // * - // * The highest bit in the oplog id part is set to 1 if the oplog id - // * is negative. - // * @todo this field could be an int for an overflow only region - // */ - // private long id; - // /** - // * Length of the bytes on disk. - // * This is always set. If the value is invalid then it will be set to 0. - // * The most significant bit is used by overflow to mark it as needing to be written. - // */ - // protected int valueLength = 0; - // // have intOffset or longOffset - // // intOffset - // /** - // * The position in the oplog (the oplog offset) where this entry's value is - // * stored - // */ - // private volatile int offsetInOplog; - // // longOffset - // /** - // * The position in the oplog (the oplog offset) where this entry's value is - // * stored - // */ - // private volatile long offsetInOplog; - // // have overflowOnly or persistence - // // overflowOnly - // // no fields - // // 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 final void updateStatsForGet(boolean hit, long time) + { setLastAccessed(time); if (hit) { incrementHitCount(); @@ -187,57 +225,51 @@ public class VMStatsDiskRegionEntryHeapObjectKey extends VMStatsDiskRegionEntryH incrementMissCount(); } } - @Override protected final void setLastModifiedAndAccessedTimes(long lastModified, long lastAccessed) { _setLastModified(lastModified); - if (!DISABLE_ACCESS_TIME_UPDATE_ON_PUT) { + if (!DISABLE_ACCESS_TIME_UPDATE_ON_PUT) { setLastAccessed(lastAccessed); } } - private volatile long lastAccessed; private volatile int hitCount; private volatile int missCount; - private static final AtomicIntegerFieldUpdater<VMStatsDiskRegionEntryHeapObjectKey> hitCountUpdater = - AtomicIntegerFieldUpdater.newUpdater(VMStatsDiskRegionEntryHeapObjectKey.class, "hitCount"); - private static final AtomicIntegerFieldUpdater<VMStatsDiskRegionEntryHeapObjectKey> missCountUpdater = - AtomicIntegerFieldUpdater.newUpdater(VMStatsDiskRegionEntryHeapObjectKey.class, "missCount"); - + + private static final AtomicIntegerFieldUpdater<VMStatsDiskRegionEntryHeapObjectKey> hitCountUpdater + = AtomicIntegerFieldUpdater.newUpdater(VMStatsDiskRegionEntryHeapObjectKey.class, "hitCount"); + private static final AtomicIntegerFieldUpdater<VMStatsDiskRegionEntryHeapObjectKey> missCountUpdater + = AtomicIntegerFieldUpdater.newUpdater(VMStatsDiskRegionEntryHeapObjectKey.class, "missCount"); + @Override public final long getLastAccessed() throws InternalStatisticsDisabledException { return this.lastAccessed; } - private void setLastAccessed(long lastAccessed) { this.lastAccessed = lastAccessed; } - @Override public final long getHitCount() throws InternalStatisticsDisabledException { return this.hitCount & 0xFFFFFFFFL; } - @Override public final long getMissCount() throws InternalStatisticsDisabledException { return this.missCount & 0xFFFFFFFFL; } - private void incrementHitCount() { hitCountUpdater.incrementAndGet(this); } - private void incrementMissCount() { missCountUpdater.incrementAndGet(this); } - @Override public final void resetCounts() throws InternalStatisticsDisabledException { - hitCountUpdater.set(this, 0); - missCountUpdater.set(this, 0); + 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) { setLastModified(currTime); @@ -245,19 +277,25 @@ public class VMStatsDiskRegionEntryHeapObjectKey extends VMStatsDiskRegionEntryH this.hitCount = 0; this.missCount = 0; } - @Override public boolean hasStats() { return true; } + + + // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + // key code - private final Object key; + private final Object key; @Override public final 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/d4f23332/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryHeapStringKey1.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryHeapStringKey1.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryHeapStringKey1.java index 87a4810..520354f 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryHeapStringKey1.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryHeapStringKey1.java @@ -15,17 +15,33 @@ 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.util.concurrent.CustomEntryConcurrentHashMap.HashEntry; // macros whose definition changes this class: -// disk: DISK +// disk: 1 // lru: LRU -// stats: STATS +// stats: 1 // versioned: VERSIONED // offheap: OFFHEAP // One of the following key macros must be defined: @@ -33,84 +49,95 @@ 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 VMStatsDiskRegionEntryHeapStringKey1 extends VMStatsDiskRegionEntryHeap { - public VMStatsDiskRegionEntryHeapStringKey1(RegionEntryContext context, String key, Object value, - boolean byteEncode) { - super(context, (value instanceof RecoveredEntry ? null : value)); + public VMStatsDiskRegionEntryHeapStringKey1 (RegionEntryContext context, String key, + + + + 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) { - for (int i = key.length() - 1; i >= 0; i--) { - // Note: we know each byte is <= 0x7f so the "& 0xff" is not needed. But I added it in to - // keep findbugs happy. - tmpBits1 |= (byte) key.charAt(i) & 0xff; + for (int i=key.length()-1; i >= 0; i--) { + // Note: we know each byte is <= 0x7f so the "& 0xff" is not needed. But I added it in to keep findbugs happy. + tmpBits1 |= (byte)key.charAt(i) & 0xff; tmpBits1 <<= 8; } - tmpBits1 |= 1 << 6; + tmpBits1 |= 1<<6; } else { - for (int i = key.length() - 1; i >= 0; i--) { + for (int i=key.length()-1; i >= 0; i--) { tmpBits1 |= key.charAt(i); tmpBits1 <<= 16; } } 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; @SuppressWarnings("unused") private volatile long lastModified; - private static final AtomicLongFieldUpdater<VMStatsDiskRegionEntryHeapStringKey1> lastModifiedUpdater = - AtomicLongFieldUpdater.newUpdater(VMStatsDiskRegionEntryHeapStringKey1.class, "lastModified"); - private volatile Object value; + private static final AtomicLongFieldUpdater<VMStatsDiskRegionEntryHeapStringKey1> lastModifiedUpdater + = AtomicLongFieldUpdater.newUpdater(VMStatsDiskRegionEntryHeapStringKey1.class, "lastModified"); + private volatile Object value; @Override protected final Object getValueField() { return this.value; } - @Override protected void setValueField(Object v) { this.value = v; } - protected long getlastModifiedField() { + protected long getLastModifiedField() { return lastModifiedUpdater.get(this); } - protected boolean compareAndSetLastModifiedField(long expectedValue, long newValue) { return lastModifiedUpdater.compareAndSet(this, expectedValue, newValue); } - /** * @see HashEntry#getEntryHash() */ public final int getEntryHash() { return this.hash; } - protected void setEntryHash(int v) { this.hash = v; } - /** * @see HashEntry#getNextEntry() */ public final HashEntry<Object, Object> getNextEntry() { return this.next; } - /** * @see HashEntry#setNextEntry */ @@ -118,23 +145,27 @@ public class VMStatsDiskRegionEntryHeapStringKey1 extends VMStatsDiskRegionEntry this.next = n; } + // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + // disk code + protected void initialize(RegionEntryContext context, Object value) { diskInitialize(context, value); } - @Override public int updateAsyncEntrySize(EnableLRU capacityController) { throw new IllegalStateException("should never be called"); } + // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + private void diskInitialize(RegionEntryContext context, Object value) { - DiskRecoveryStore drs = (DiskRecoveryStore) context; + DiskRecoveryStore drs = (DiskRecoveryStore)context; DiskStoreImpl ds = drs.getDiskStore(); long maxOplogSize = ds.getMaxOplogSize(); - // get appropriate instance of DiskId implementation based on maxOplogSize + //get appropriate instance of DiskId implementation based on maxOplogSize this.id = DiskId.createDiskId(maxOplogSize, true/* is persistence */, ds.needsLinkedList()); Helper.initialize(this, drs, value); } @@ -144,60 +175,64 @@ public class VMStatsDiskRegionEntryHeapStringKey1 extends VMStatsDiskRegionEntry * * @since GemFire 5.1 */ - protected DiskId id;// = new DiskId(); - + protected DiskId id;//= new DiskId(); public DiskId getDiskId() { return this.id; } - @Override void setDiskId(RegionEntry old) { - this.id = ((AbstractDiskRegionEntry) old).getDiskId(); + this.id = ((AbstractDiskRegionEntry)old).getDiskId(); } +// // inlining DiskId +// // always have these fields +// /** +// * id consists of +// * most significant +// * 1 byte = users bits +// * 2-8 bytes = oplog id +// * least significant. +// * +// * The highest bit in the oplog id part is set to 1 if the oplog id +// * is negative. +// * @todo this field could be an int for an overflow only region +// */ +// private long id; +// /** +// * Length of the bytes on disk. +// * This is always set. If the value is invalid then it will be set to 0. +// * The most significant bit is used by overflow to mark it as needing to be written. +// */ +// protected int valueLength = 0; +// // have intOffset or longOffset +// // intOffset +// /** +// * The position in the oplog (the oplog offset) where this entry's value is +// * stored +// */ +// private volatile int offsetInOplog; +// // longOffset +// /** +// * The position in the oplog (the oplog offset) where this entry's value is +// * stored +// */ +// private volatile long offsetInOplog; +// // have overflowOnly or persistence +// // overflowOnly +// // no fields +// // persistent +// /** unique entry identifier * */ +// private long keyId; + + + + - // // inlining DiskId - // // always have these fields - // /** - // * id consists of - // * most significant - // * 1 byte = users bits - // * 2-8 bytes = oplog id - // * least significant. - // * - // * The highest bit in the oplog id part is set to 1 if the oplog id - // * is negative. - // * @todo this field could be an int for an overflow only region - // */ - // private long id; - // /** - // * Length of the bytes on disk. - // * This is always set. If the value is invalid then it will be set to 0. - // * The most significant bit is used by overflow to mark it as needing to be written. - // */ - // protected int valueLength = 0; - // // have intOffset or longOffset - // // intOffset - // /** - // * The position in the oplog (the oplog offset) where this entry's value is - // * stored - // */ - // private volatile int offsetInOplog; - // // longOffset - // /** - // * The position in the oplog (the oplog offset) where this entry's value is - // * stored - // */ - // private volatile long offsetInOplog; - // // have overflowOnly or persistence - // // overflowOnly - // // no fields - // // 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 final void updateStatsForGet(boolean hit, long time) + { setLastAccessed(time); if (hit) { incrementHitCount(); @@ -205,57 +240,51 @@ public class VMStatsDiskRegionEntryHeapStringKey1 extends VMStatsDiskRegionEntry incrementMissCount(); } } - @Override protected final void setLastModifiedAndAccessedTimes(long lastModified, long lastAccessed) { _setLastModified(lastModified); - if (!DISABLE_ACCESS_TIME_UPDATE_ON_PUT) { + if (!DISABLE_ACCESS_TIME_UPDATE_ON_PUT) { setLastAccessed(lastAccessed); } } - private volatile long lastAccessed; private volatile int hitCount; private volatile int missCount; - private static final AtomicIntegerFieldUpdater<VMStatsDiskRegionEntryHeapStringKey1> hitCountUpdater = - AtomicIntegerFieldUpdater.newUpdater(VMStatsDiskRegionEntryHeapStringKey1.class, "hitCount"); - private static final AtomicIntegerFieldUpdater<VMStatsDiskRegionEntryHeapStringKey1> missCountUpdater = - AtomicIntegerFieldUpdater.newUpdater(VMStatsDiskRegionEntryHeapStringKey1.class, "missCount"); - + + private static final AtomicIntegerFieldUpdater<VMStatsDiskRegionEntryHeapStringKey1> hitCountUpdater + = AtomicIntegerFieldUpdater.newUpdater(VMStatsDiskRegionEntryHeapStringKey1.class, "hitCount"); + private static final AtomicIntegerFieldUpdater<VMStatsDiskRegionEntryHeapStringKey1> missCountUpdater + = AtomicIntegerFieldUpdater.newUpdater(VMStatsDiskRegionEntryHeapStringKey1.class, "missCount"); + @Override public final long getLastAccessed() throws InternalStatisticsDisabledException { return this.lastAccessed; } - private void setLastAccessed(long lastAccessed) { this.lastAccessed = lastAccessed; } - @Override public final long getHitCount() throws InternalStatisticsDisabledException { return this.hitCount & 0xFFFFFFFFL; } - @Override public final long getMissCount() throws InternalStatisticsDisabledException { return this.missCount & 0xFFFFFFFFL; } - private void incrementHitCount() { hitCountUpdater.incrementAndGet(this); } - private void incrementMissCount() { missCountUpdater.incrementAndGet(this); } - @Override public final void resetCounts() throws InternalStatisticsDisabledException { - hitCountUpdater.set(this, 0); - missCountUpdater.set(this, 0); + 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) { setLastModified(currTime); @@ -263,38 +292,39 @@ public class VMStatsDiskRegionEntryHeapStringKey1 extends VMStatsDiskRegionEntry this.hitCount = 0; this.missCount = 0; } - @Override public boolean hasStats() { return true; } + + + // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + // key code - private final long bits1; + private final long bits1; private int getKeyLength() { return (int) (this.bits1 & 0x003fL); } - private int getEncoding() { // 0 means encoded as char // 1 means encoded as bytes that are all <= 0x7f; return (int) (this.bits1 >> 6) & 0x03; } - @Override public final Object getKey() { int keylen = getKeyLength(); char[] chars = new char[keylen]; long tmpBits1 = this.bits1; if (getEncoding() == 1) { - for (int i = 0; i < keylen; i++) { + for (int i=0; i < keylen; i++) { tmpBits1 >>= 8; - chars[i] = (char) (tmpBits1 & 0x00ff); + chars[i] = (char) (tmpBits1 & 0x00ff); } } else { - for (int i = 0; i < keylen; i++) { + for (int i=0; i < keylen; i++) { tmpBits1 >>= 16; chars[i] = (char) (tmpBits1 & 0x00FFff); } @@ -303,15 +333,16 @@ public class VMStatsDiskRegionEntryHeapStringKey1 extends VMStatsDiskRegionEntry } // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + @Override public boolean isKeyEqual(Object k) { if (k instanceof String) { - String str = (String) k; + String str = (String)k; int keylen = getKeyLength(); if (str.length() == keylen) { long tmpBits1 = this.bits1; if (getEncoding() == 1) { - for (int i = 0; i < keylen; i++) { + for (int i=0; i < keylen; i++) { tmpBits1 >>= 8; char c = (char) (tmpBits1 & 0x00ff); if (str.charAt(i) != c) { @@ -319,7 +350,7 @@ public class VMStatsDiskRegionEntryHeapStringKey1 extends VMStatsDiskRegionEntry } } } else { - for (int i = 0; i < keylen; i++) { + for (int i=0; i < keylen; i++) { tmpBits1 >>= 16; char c = (char) (tmpBits1 & 0x00FFff); if (str.charAt(i) != c) { @@ -332,5 +363,8 @@ public class VMStatsDiskRegionEntryHeapStringKey1 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/d4f23332/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryHeapStringKey2.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryHeapStringKey2.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryHeapStringKey2.java index 5dfaf0f..9dd24d0 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryHeapStringKey2.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryHeapStringKey2.java @@ -15,17 +15,33 @@ 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.util.concurrent.CustomEntryConcurrentHashMap.HashEntry; // macros whose definition changes this class: -// disk: DISK +// disk: 1 // lru: LRU -// stats: STATS +// stats: 1 // versioned: VERSIONED // offheap: OFFHEAP // One of the following key macros must be defined: @@ -34,35 +50,50 @@ import org.apache.geode.internal.util.concurrent.CustomEntryConcurrentHashMap.Ha // key long: KEY_LONG // key uuid: KEY_UUID // key string1: KEY_STRING1 -// key string2: KEY_STRING2 +// key string2: 1 + /** * Do not modify this class. It was generated. Instead modify LeafRegionEntry.cpp and then run * ./dev-tools/generateRegionEntryClasses.sh (it must be run from the top level directory). */ public class VMStatsDiskRegionEntryHeapStringKey2 extends VMStatsDiskRegionEntryHeap { - public VMStatsDiskRegionEntryHeapStringKey2(RegionEntryContext context, String key, Object value, - boolean byteEncode) { - super(context, (value instanceof RecoveredEntry ? null : value)); + public VMStatsDiskRegionEntryHeapStringKey2 (RegionEntryContext context, String key, + + + + 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; if (byteEncode) { - for (int i = key.length() - 1; i >= 0; i--) { - // Note: we know each byte is <= 0x7f so the "& 0xff" is not needed. But I added it in to - // keep findbugs happy. + for (int i=key.length()-1; i >= 0; i--) { + // Note: we know each byte is <= 0x7f so the "& 0xff" is not needed. But I added it in to keep findbugs happy. if (i < 7) { - tmpBits1 |= (byte) key.charAt(i) & 0xff; + tmpBits1 |= (byte)key.charAt(i) & 0xff; tmpBits1 <<= 8; } else { tmpBits2 <<= 8; - tmpBits2 |= (byte) key.charAt(i) & 0xff; + tmpBits2 |= (byte)key.charAt(i) & 0xff; } } - tmpBits1 |= 1 << 6; + tmpBits1 |= 1<<6; } else { - for (int i = key.length() - 1; i >= 0; i--) { + for (int i=key.length()-1; i >= 0; i--) { if (i < 3) { tmpBits1 |= key.charAt(i); tmpBits1 <<= 16; @@ -75,54 +106,50 @@ public class VMStatsDiskRegionEntryHeapStringKey2 extends VMStatsDiskRegionEntry 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; @SuppressWarnings("unused") private volatile long lastModified; - private static final AtomicLongFieldUpdater<VMStatsDiskRegionEntryHeapStringKey2> lastModifiedUpdater = - AtomicLongFieldUpdater.newUpdater(VMStatsDiskRegionEntryHeapStringKey2.class, "lastModified"); - private volatile Object value; + private static final AtomicLongFieldUpdater<VMStatsDiskRegionEntryHeapStringKey2> lastModifiedUpdater + = AtomicLongFieldUpdater.newUpdater(VMStatsDiskRegionEntryHeapStringKey2.class, "lastModified"); + private volatile Object value; @Override protected final Object getValueField() { return this.value; } - @Override protected void setValueField(Object v) { this.value = v; } - protected long getlastModifiedField() { + protected long getLastModifiedField() { return lastModifiedUpdater.get(this); } - protected boolean compareAndSetLastModifiedField(long expectedValue, long newValue) { return lastModifiedUpdater.compareAndSet(this, expectedValue, newValue); } - /** * @see HashEntry#getEntryHash() */ public final int getEntryHash() { return this.hash; } - protected void setEntryHash(int v) { this.hash = v; } - /** * @see HashEntry#getNextEntry() */ public final HashEntry<Object, Object> getNextEntry() { return this.next; } - /** * @see HashEntry#setNextEntry */ @@ -130,23 +157,27 @@ public class VMStatsDiskRegionEntryHeapStringKey2 extends VMStatsDiskRegionEntry this.next = n; } + // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + // disk code + protected void initialize(RegionEntryContext context, Object value) { diskInitialize(context, value); } - @Override public int updateAsyncEntrySize(EnableLRU capacityController) { throw new IllegalStateException("should never be called"); } + // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + private void diskInitialize(RegionEntryContext context, Object value) { - DiskRecoveryStore drs = (DiskRecoveryStore) context; + DiskRecoveryStore drs = (DiskRecoveryStore)context; DiskStoreImpl ds = drs.getDiskStore(); long maxOplogSize = ds.getMaxOplogSize(); - // get appropriate instance of DiskId implementation based on maxOplogSize + //get appropriate instance of DiskId implementation based on maxOplogSize this.id = DiskId.createDiskId(maxOplogSize, true/* is persistence */, ds.needsLinkedList()); Helper.initialize(this, drs, value); } @@ -156,60 +187,64 @@ public class VMStatsDiskRegionEntryHeapStringKey2 extends VMStatsDiskRegionEntry * * @since GemFire 5.1 */ - protected DiskId id;// = new DiskId(); - + protected DiskId id;//= new DiskId(); public DiskId getDiskId() { return this.id; } - @Override void setDiskId(RegionEntry old) { - this.id = ((AbstractDiskRegionEntry) old).getDiskId(); + this.id = ((AbstractDiskRegionEntry)old).getDiskId(); } +// // inlining DiskId +// // always have these fields +// /** +// * id consists of +// * most significant +// * 1 byte = users bits +// * 2-8 bytes = oplog id +// * least significant. +// * +// * The highest bit in the oplog id part is set to 1 if the oplog id +// * is negative. +// * @todo this field could be an int for an overflow only region +// */ +// private long id; +// /** +// * Length of the bytes on disk. +// * This is always set. If the value is invalid then it will be set to 0. +// * The most significant bit is used by overflow to mark it as needing to be written. +// */ +// protected int valueLength = 0; +// // have intOffset or longOffset +// // intOffset +// /** +// * The position in the oplog (the oplog offset) where this entry's value is +// * stored +// */ +// private volatile int offsetInOplog; +// // longOffset +// /** +// * The position in the oplog (the oplog offset) where this entry's value is +// * stored +// */ +// private volatile long offsetInOplog; +// // have overflowOnly or persistence +// // overflowOnly +// // no fields +// // persistent +// /** unique entry identifier * */ +// private long keyId; + + + + - // // inlining DiskId - // // always have these fields - // /** - // * id consists of - // * most significant - // * 1 byte = users bits - // * 2-8 bytes = oplog id - // * least significant. - // * - // * The highest bit in the oplog id part is set to 1 if the oplog id - // * is negative. - // * @todo this field could be an int for an overflow only region - // */ - // private long id; - // /** - // * Length of the bytes on disk. - // * This is always set. If the value is invalid then it will be set to 0. - // * The most significant bit is used by overflow to mark it as needing to be written. - // */ - // protected int valueLength = 0; - // // have intOffset or longOffset - // // intOffset - // /** - // * The position in the oplog (the oplog offset) where this entry's value is - // * stored - // */ - // private volatile int offsetInOplog; - // // longOffset - // /** - // * The position in the oplog (the oplog offset) where this entry's value is - // * stored - // */ - // private volatile long offsetInOplog; - // // have overflowOnly or persistence - // // overflowOnly - // // no fields - // // 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 final void updateStatsForGet(boolean hit, long time) + { setLastAccessed(time); if (hit) { incrementHitCount(); @@ -217,57 +252,51 @@ public class VMStatsDiskRegionEntryHeapStringKey2 extends VMStatsDiskRegionEntry incrementMissCount(); } } - @Override protected final void setLastModifiedAndAccessedTimes(long lastModified, long lastAccessed) { _setLastModified(lastModified); - if (!DISABLE_ACCESS_TIME_UPDATE_ON_PUT) { + if (!DISABLE_ACCESS_TIME_UPDATE_ON_PUT) { setLastAccessed(lastAccessed); } } - private volatile long lastAccessed; private volatile int hitCount; private volatile int missCount; - private static final AtomicIntegerFieldUpdater<VMStatsDiskRegionEntryHeapStringKey2> hitCountUpdater = - AtomicIntegerFieldUpdater.newUpdater(VMStatsDiskRegionEntryHeapStringKey2.class, "hitCount"); - private static final AtomicIntegerFieldUpdater<VMStatsDiskRegionEntryHeapStringKey2> missCountUpdater = - AtomicIntegerFieldUpdater.newUpdater(VMStatsDiskRegionEntryHeapStringKey2.class, "missCount"); - + + private static final AtomicIntegerFieldUpdater<VMStatsDiskRegionEntryHeapStringKey2> hitCountUpdater + = AtomicIntegerFieldUpdater.newUpdater(VMStatsDiskRegionEntryHeapStringKey2.class, "hitCount"); + private static final AtomicIntegerFieldUpdater<VMStatsDiskRegionEntryHeapStringKey2> missCountUpdater + = AtomicIntegerFieldUpdater.newUpdater(VMStatsDiskRegionEntryHeapStringKey2.class, "missCount"); + @Override public final long getLastAccessed() throws InternalStatisticsDisabledException { return this.lastAccessed; } - private void setLastAccessed(long lastAccessed) { this.lastAccessed = lastAccessed; } - @Override public final long getHitCount() throws InternalStatisticsDisabledException { return this.hitCount & 0xFFFFFFFFL; } - @Override public final long getMissCount() throws InternalStatisticsDisabledException { return this.missCount & 0xFFFFFFFFL; } - private void incrementHitCount() { hitCountUpdater.incrementAndGet(this); } - private void incrementMissCount() { missCountUpdater.incrementAndGet(this); } - @Override public final void resetCounts() throws InternalStatisticsDisabledException { - hitCountUpdater.set(this, 0); - missCountUpdater.set(this, 0); + 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) { setLastModified(currTime); @@ -275,31 +304,32 @@ public class VMStatsDiskRegionEntryHeapStringKey2 extends VMStatsDiskRegionEntry this.hitCount = 0; this.missCount = 0; } - @Override public boolean hasStats() { 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. private final long bits1; // bits2 encodes character data private final long bits2; - private int getKeyLength() { return (int) (this.bits1 & 0x003fL); } - private int getEncoding() { // 0 means encoded as char // 1 means encoded as bytes that are all <= 0x7f; return (int) (this.bits1 >> 6) & 0x03; } - @Override public final Object getKey() { int keylen = getKeyLength(); @@ -307,7 +337,7 @@ public class VMStatsDiskRegionEntryHeapStringKey2 extends VMStatsDiskRegionEntry long tmpBits1 = this.bits1; long tmpBits2 = this.bits2; if (getEncoding() == 1) { - for (int i = 0; i < keylen; i++) { + for (int i=0; i < keylen; i++) { if (i < 7) { tmpBits1 >>= 8; chars[i] = (char) (tmpBits1 & 0x00ff); @@ -317,10 +347,10 @@ public class VMStatsDiskRegionEntryHeapStringKey2 extends VMStatsDiskRegionEntry } } } else { - for (int i = 0; i < keylen; i++) { + for (int i=0; i < keylen; i++) { if (i < 3) { tmpBits1 >>= 16; - chars[i] = (char) (tmpBits1 & 0x00FFff); + chars[i] = (char) (tmpBits1 & 0x00FFff); } else { chars[i] = (char) (tmpBits2 & 0x00FFff); tmpBits2 >>= 16; @@ -331,16 +361,17 @@ public class VMStatsDiskRegionEntryHeapStringKey2 extends VMStatsDiskRegionEntry } // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + @Override public boolean isKeyEqual(Object k) { if (k instanceof String) { - String str = (String) k; + String str = (String)k; int keylen = getKeyLength(); if (str.length() == keylen) { long tmpBits1 = this.bits1; long tmpBits2 = this.bits2; if (getEncoding() == 1) { - for (int i = 0; i < keylen; i++) { + for (int i=0; i < keylen; i++) { char c; if (i < 7) { tmpBits1 >>= 8; @@ -354,7 +385,7 @@ public class VMStatsDiskRegionEntryHeapStringKey2 extends VMStatsDiskRegionEntry } } } else { - for (int i = 0; i < keylen; i++) { + for (int i=0; i < keylen; i++) { char c; if (i < 3) { tmpBits1 >>= 16; @@ -373,5 +404,7 @@ public class VMStatsDiskRegionEntryHeapStringKey2 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/d4f23332/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryHeapUUIDKey.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryHeapUUIDKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryHeapUUIDKey.java index 1eefa4b..699e631 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryHeapUUIDKey.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryHeapUUIDKey.java @@ -15,86 +15,121 @@ 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.util.concurrent.CustomEntryConcurrentHashMap.HashEntry; // macros whose definition changes this class: -// disk: DISK +// disk: 1 // lru: LRU -// stats: STATS +// 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 VMStatsDiskRegionEntryHeapUUIDKey extends VMStatsDiskRegionEntryHeap { - public VMStatsDiskRegionEntryHeapUUIDKey(RegionEntryContext context, UUID key, Object value) { - super(context, (value instanceof RecoveredEntry ? null : value)); + public VMStatsDiskRegionEntryHeapUUIDKey (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; @SuppressWarnings("unused") private volatile long lastModified; - private static final AtomicLongFieldUpdater<VMStatsDiskRegionEntryHeapUUIDKey> lastModifiedUpdater = - AtomicLongFieldUpdater.newUpdater(VMStatsDiskRegionEntryHeapUUIDKey.class, "lastModified"); - private volatile Object value; + private static final AtomicLongFieldUpdater<VMStatsDiskRegionEntryHeapUUIDKey> lastModifiedUpdater + = AtomicLongFieldUpdater.newUpdater(VMStatsDiskRegionEntryHeapUUIDKey.class, "lastModified"); + private volatile Object value; @Override protected final Object getValueField() { return this.value; } - @Override protected void setValueField(Object v) { this.value = v; } - protected long getlastModifiedField() { + protected long getLastModifiedField() { return lastModifiedUpdater.get(this); } - protected boolean compareAndSetLastModifiedField(long expectedValue, long newValue) { return lastModifiedUpdater.compareAndSet(this, expectedValue, newValue); } - /** * @see HashEntry#getEntryHash() */ public final int getEntryHash() { return this.hash; } - protected void setEntryHash(int v) { this.hash = v; } - /** * @see HashEntry#getNextEntry() */ public final HashEntry<Object, Object> getNextEntry() { return this.next; } - /** * @see HashEntry#setNextEntry */ @@ -102,23 +137,27 @@ public class VMStatsDiskRegionEntryHeapUUIDKey extends VMStatsDiskRegionEntryHea this.next = n; } + // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + // disk code + protected void initialize(RegionEntryContext context, Object value) { diskInitialize(context, value); } - @Override public int updateAsyncEntrySize(EnableLRU capacityController) { throw new IllegalStateException("should never be called"); } + // DO NOT modify this class. It was generated from LeafRegionEntry.cpp + private void diskInitialize(RegionEntryContext context, Object value) { - DiskRecoveryStore drs = (DiskRecoveryStore) context; + DiskRecoveryStore drs = (DiskRecoveryStore)context; DiskStoreImpl ds = drs.getDiskStore(); long maxOplogSize = ds.getMaxOplogSize(); - // get appropriate instance of DiskId implementation based on maxOplogSize + //get appropriate instance of DiskId implementation based on maxOplogSize this.id = DiskId.createDiskId(maxOplogSize, true/* is persistence */, ds.needsLinkedList()); Helper.initialize(this, drs, value); } @@ -128,60 +167,64 @@ public class VMStatsDiskRegionEntryHeapUUIDKey extends VMStatsDiskRegionEntryHea * * @since GemFire 5.1 */ - protected DiskId id;// = new DiskId(); - + protected DiskId id;//= new DiskId(); public DiskId getDiskId() { return this.id; } - @Override void setDiskId(RegionEntry old) { - this.id = ((AbstractDiskRegionEntry) old).getDiskId(); + this.id = ((AbstractDiskRegionEntry)old).getDiskId(); } +// // inlining DiskId +// // always have these fields +// /** +// * id consists of +// * most significant +// * 1 byte = users bits +// * 2-8 bytes = oplog id +// * least significant. +// * +// * The highest bit in the oplog id part is set to 1 if the oplog id +// * is negative. +// * @todo this field could be an int for an overflow only region +// */ +// private long id; +// /** +// * Length of the bytes on disk. +// * This is always set. If the value is invalid then it will be set to 0. +// * The most significant bit is used by overflow to mark it as needing to be written. +// */ +// protected int valueLength = 0; +// // have intOffset or longOffset +// // intOffset +// /** +// * The position in the oplog (the oplog offset) where this entry's value is +// * stored +// */ +// private volatile int offsetInOplog; +// // longOffset +// /** +// * The position in the oplog (the oplog offset) where this entry's value is +// * stored +// */ +// private volatile long offsetInOplog; +// // have overflowOnly or persistence +// // overflowOnly +// // no fields +// // persistent +// /** unique entry identifier * */ +// private long keyId; + + + + - // // inlining DiskId - // // always have these fields - // /** - // * id consists of - // * most significant - // * 1 byte = users bits - // * 2-8 bytes = oplog id - // * least significant. - // * - // * The highest bit in the oplog id part is set to 1 if the oplog id - // * is negative. - // * @todo this field could be an int for an overflow only region - // */ - // private long id; - // /** - // * Length of the bytes on disk. - // * This is always set. If the value is invalid then it will be set to 0. - // * The most significant bit is used by overflow to mark it as needing to be written. - // */ - // protected int valueLength = 0; - // // have intOffset or longOffset - // // intOffset - // /** - // * The position in the oplog (the oplog offset) where this entry's value is - // * stored - // */ - // private volatile int offsetInOplog; - // // longOffset - // /** - // * The position in the oplog (the oplog offset) where this entry's value is - // * stored - // */ - // private volatile long offsetInOplog; - // // have overflowOnly or persistence - // // overflowOnly - // // no fields - // // 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 final void updateStatsForGet(boolean hit, long time) + { setLastAccessed(time); if (hit) { incrementHitCount(); @@ -189,57 +232,51 @@ public class VMStatsDiskRegionEntryHeapUUIDKey extends VMStatsDiskRegionEntryHea incrementMissCount(); } } - @Override protected final void setLastModifiedAndAccessedTimes(long lastModified, long lastAccessed) { _setLastModified(lastModified); - if (!DISABLE_ACCESS_TIME_UPDATE_ON_PUT) { + if (!DISABLE_ACCESS_TIME_UPDATE_ON_PUT) { setLastAccessed(lastAccessed); } } - private volatile long lastAccessed; private volatile int hitCount; private volatile int missCount; - private static final AtomicIntegerFieldUpdater<VMStatsDiskRegionEntryHeapUUIDKey> hitCountUpdater = - AtomicIntegerFieldUpdater.newUpdater(VMStatsDiskRegionEntryHeapUUIDKey.class, "hitCount"); - private static final AtomicIntegerFieldUpdater<VMStatsDiskRegionEntryHeapUUIDKey> missCountUpdater = - AtomicIntegerFieldUpdater.newUpdater(VMStatsDiskRegionEntryHeapUUIDKey.class, "missCount"); - + + private static final AtomicIntegerFieldUpdater<VMStatsDiskRegionEntryHeapUUIDKey> hitCountUpdater + = AtomicIntegerFieldUpdater.newUpdater(VMStatsDiskRegionEntryHeapUUIDKey.class, "hitCount"); + private static final AtomicIntegerFieldUpdater<VMStatsDiskRegionEntryHeapUUIDKey> missCountUpdater + = AtomicIntegerFieldUpdater.newUpdater(VMStatsDiskRegionEntryHeapUUIDKey.class, "missCount"); + @Override public final long getLastAccessed() throws InternalStatisticsDisabledException { return this.lastAccessed; } - private void setLastAccessed(long lastAccessed) { this.lastAccessed = lastAccessed; } - @Override public final long getHitCount() throws InternalStatisticsDisabledException { return this.hitCount & 0xFFFFFFFFL; } - @Override public final long getMissCount() throws InternalStatisticsDisabledException { return this.missCount & 0xFFFFFFFFL; } - private void incrementHitCount() { hitCountUpdater.incrementAndGet(this); } - private void incrementMissCount() { missCountUpdater.incrementAndGet(this); } - @Override public final void resetCounts() throws InternalStatisticsDisabledException { - hitCountUpdater.set(this, 0); - missCountUpdater.set(this, 0); + 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) { setLastModified(currTime); @@ -247,22 +284,24 @@ public class VMStatsDiskRegionEntryHeapUUIDKey extends VMStatsDiskRegionEntryHea this.hitCount = 0; this.missCount = 0; } - @Override public boolean hasStats() { 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() { return new UUID(this.keyMostSigBits, this.keyLeastSigBits); } - @Override public boolean isKeyEqual(Object k) { if (k instanceof UUID) { @@ -272,5 +311,8 @@ public class VMStatsDiskRegionEntryHeapUUIDKey extends VMStatsDiskRegionEntryHea } return false; } + + // DO NOT modify this class. It was generated from LeafRegionEntry.cpp } +
