You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by kl...@apache.org on 2017/05/16 02:19:43 UTC
[33/78] geode git commit: GEODE-2929: Remove superfluous final from
internal methods
http://git-wip-us.apache.org/repos/asf/geode/blob/30f455bb/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 e2d498d..d6d664b 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,55 +15,95 @@
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() {
+ protected Object getValueField() {
return this.value;
}
-
@Override
protected void setValueField(Object v) {
this.value = v;
@@ -72,53 +112,52 @@ public class VMStatsDiskRegionEntryHeapUUIDKey extends VMStatsDiskRegionEntryHea
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() {
+ public int getEntryHash() {
return this.hash;
}
-
protected void setEntryHash(int v) {
this.hash = v;
}
-
/**
* @see HashEntry#getNextEntry()
*/
- public final HashEntry<Object, Object> getNextEntry() {
+ public HashEntry<Object, Object> getNextEntry() {
return this.next;
}
-
/**
* @see HashEntry#setNextEntry
*/
- public final void setNextEntry(final HashEntry<Object, Object> n) {
+ public void setNextEntry(final HashEntry<Object, Object> n) {
this.next = n;
}
+
// DO NOT modify this class. It was generated from LeafRegionEntry.cpp
+
// disk code
+
protected void initialize(RegionEntryContext context, Object value) {
diskInitialize(context, value);
}
-
@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,63 @@ 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 void updateStatsForGet(boolean hit, long time) {
setLastAccessed(time);
if (hit) {
incrementHitCount();
@@ -189,80 +231,76 @@ public class VMStatsDiskRegionEntryHeapUUIDKey extends VMStatsDiskRegionEntryHea
incrementMissCount();
}
}
-
@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) {
+ 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 {
+ public long getLastAccessed() throws InternalStatisticsDisabledException {
return this.lastAccessed;
}
-
private void setLastAccessed(long lastAccessed) {
this.lastAccessed = lastAccessed;
}
-
@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;
}
-
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);
+ 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;
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() {
+ public Object getKey() {
return new UUID(this.keyMostSigBits, this.keyLeastSigBits);
}
-
@Override
public boolean isKeyEqual(Object k) {
if (k instanceof UUID) {
@@ -272,5 +310,8 @@ public class VMStatsDiskRegionEntryHeapUUIDKey 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/30f455bb/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeapIntKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeapIntKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeapIntKey.java
index e7c90b7..8ef1a20 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeapIntKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeapIntKey.java
@@ -15,74 +15,110 @@
package org.apache.geode.internal.cache;
// DO NOT modify this class. It was generated from LeafRegionEntry.cpp
+
+
+
+
+
+
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
+
import java.util.concurrent.atomic.AtomicLongFieldUpdater;
+
+
+
+
import org.apache.geode.internal.cache.lru.EnableLRU;
+
+
import org.apache.geode.internal.cache.persistence.DiskRecoveryStore;
+
+
import org.apache.geode.internal.InternalStatisticsDisabledException;
+
import org.apache.geode.internal.offheap.OffHeapRegionEntryHelper;
import org.apache.geode.internal.offheap.annotations.Released;
import org.apache.geode.internal.offheap.annotations.Retained;
import org.apache.geode.internal.offheap.annotations.Unretained;
+
import org.apache.geode.internal.util.concurrent.CustomEntryConcurrentHashMap.HashEntry;
// macros whose definition changes this class:
-// disk: DISK
+// disk: 1
// lru: LRU
-// stats: STATS
+// stats: 1
// versioned: VERSIONED
-// offheap: OFFHEAP
+// offheap: 1
// One of the following key macros must be defined:
// key object: KEY_OBJECT
-// key int: KEY_INT
+// key 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 VMStatsDiskRegionEntryOffHeapIntKey extends VMStatsDiskRegionEntryOffHeap {
- public VMStatsDiskRegionEntryOffHeapIntKey(RegionEntryContext context, int key,
- @Retained Object value) {
- super(context, (value instanceof RecoveredEntry ? null : value));
+ public VMStatsDiskRegionEntryOffHeapIntKey (RegionEntryContext context, int key,
+
+ @Retained
+
+ Object value
+
+
+
+ ) {
+ super(context,
+
+ (value instanceof RecoveredEntry ? null : value)
+
+
+
+ );
// DO NOT modify this class. It was generated from LeafRegionEntry.cpp
+
initialize(context, value);
+
+
+
+
this.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<VMStatsDiskRegionEntryOffHeapIntKey> lastModifiedUpdater =
- AtomicLongFieldUpdater.newUpdater(VMStatsDiskRegionEntryOffHeapIntKey.class, "lastModified");
+ private static final AtomicLongFieldUpdater<VMStatsDiskRegionEntryOffHeapIntKey> lastModifiedUpdater
+ = AtomicLongFieldUpdater.newUpdater(VMStatsDiskRegionEntryOffHeapIntKey.class, "lastModified");
+
/**
* All access done using ohAddrUpdater so it is used even though the compiler can not tell it is.
*/
@SuppressWarnings("unused")
- @Retained
- @Released
- private volatile long ohAddress;
+ @Retained @Released private volatile long ohAddress;
/**
- * I needed to add this because I wanted clear to call setValue which normally can only be called
- * while the re is synced. But if I sync in that code it causes a lock ordering deadlock with the
- * disk regions because they also get a rw lock in clear. Some hardware platforms do not support
- * CAS on a long. If gemfire is run on one of those the AtomicLongFieldUpdater does a sync on the
- * re and we will once again be deadlocked. I don't know if we support any of the hardware
- * platforms that do not have a 64bit CAS. If we do then we can expect deadlocks on disk regions.
+ * I needed to add this because I wanted clear to call setValue which normally can only be called while the re is synced.
+ * But if I sync in that code it causes a lock ordering deadlock with the disk regions because they also get a rw lock in clear.
+ * Some hardware platforms do not support CAS on a long. If gemfire is run on one of those the AtomicLongFieldUpdater does a sync
+ * on the re and we will once again be deadlocked.
+ * I don't know if we support any of the hardware platforms that do not have a 64bit CAS. If we do then we can expect deadlocks
+ * on disk regions.
*/
- private final static AtomicLongFieldUpdater<VMStatsDiskRegionEntryOffHeapIntKey> ohAddrUpdater =
- AtomicLongFieldUpdater.newUpdater(VMStatsDiskRegionEntryOffHeapIntKey.class, "ohAddress");
-
+ private final static AtomicLongFieldUpdater<VMStatsDiskRegionEntryOffHeapIntKey> ohAddrUpdater = AtomicLongFieldUpdater.newUpdater(VMStatsDiskRegionEntryOffHeapIntKey.class, "ohAddress");
+
@Override
public Token getValueAsToken() {
return OffHeapRegionEntryHelper.getValueAsToken(this);
}
-
+
@Override
protected Object getValueField() {
return OffHeapRegionEntryHelper._getValue(this);
@@ -90,13 +126,18 @@ public class VMStatsDiskRegionEntryOffHeapIntKey extends VMStatsDiskRegionEntryO
// 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);
}
@@ -110,71 +151,72 @@ public class VMStatsDiskRegionEntryOffHeapIntKey extends VMStatsDiskRegionEntryO
public boolean setAddress(long expectedAddr, long newAddr) {
return ohAddrUpdater.compareAndSet(this, expectedAddr, newAddr);
}
-
+
@Override
+
@Released
+
public void release() {
OffHeapRegionEntryHelper.releaseEntry(this);
}
-
+
@Override
public void returnToPool() {
// Deadcoded for now; never was working
- // if (this instanceof VMThinRegionEntryLongKey) {
- // factory.returnToPool((VMThinRegionEntryLongKey)this);
- // }
+// if (this instanceof VMThinRegionEntryLongKey) {
+// factory.returnToPool((VMThinRegionEntryLongKey)this);
+// }
}
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() {
+ public int getEntryHash() {
return this.hash;
}
-
protected void setEntryHash(int v) {
this.hash = v;
}
-
/**
* @see HashEntry#getNextEntry()
*/
- public final HashEntry<Object, Object> getNextEntry() {
+ public HashEntry<Object, Object> getNextEntry() {
return this.next;
}
-
/**
* @see HashEntry#setNextEntry
*/
- public final void setNextEntry(final HashEntry<Object, Object> n) {
+ public void setNextEntry(final HashEntry<Object, Object> n) {
this.next = n;
}
+
// DO NOT modify this class. It was generated from LeafRegionEntry.cpp
+
// disk code
+
protected void initialize(RegionEntryContext context, Object value) {
diskInitialize(context, value);
}
-
@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);
}
@@ -184,60 +226,63 @@ public class VMStatsDiskRegionEntryOffHeapIntKey extends VMStatsDiskRegionEntryO
*
* @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();
- }
-
- // // 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;
+ 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;
+
+
+
+
+
// 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();
@@ -245,79 +290,82 @@ public class VMStatsDiskRegionEntryOffHeapIntKey extends VMStatsDiskRegionEntryO
incrementMissCount();
}
}
-
@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) {
+ 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<VMStatsDiskRegionEntryOffHeapIntKey> hitCountUpdater =
- AtomicIntegerFieldUpdater.newUpdater(VMStatsDiskRegionEntryOffHeapIntKey.class, "hitCount");
- private static final AtomicIntegerFieldUpdater<VMStatsDiskRegionEntryOffHeapIntKey> missCountUpdater =
- AtomicIntegerFieldUpdater.newUpdater(VMStatsDiskRegionEntryOffHeapIntKey.class, "missCount");
-
+
+ private static final AtomicIntegerFieldUpdater<VMStatsDiskRegionEntryOffHeapIntKey> hitCountUpdater
+ = AtomicIntegerFieldUpdater.newUpdater(VMStatsDiskRegionEntryOffHeapIntKey.class, "hitCount");
+ private static final AtomicIntegerFieldUpdater<VMStatsDiskRegionEntryOffHeapIntKey> missCountUpdater
+ = AtomicIntegerFieldUpdater.newUpdater(VMStatsDiskRegionEntryOffHeapIntKey.class, "missCount");
+
@Override
- public final long getLastAccessed() throws InternalStatisticsDisabledException {
+ public long getLastAccessed() throws InternalStatisticsDisabledException {
return this.lastAccessed;
}
-
private void setLastAccessed(long lastAccessed) {
this.lastAccessed = lastAccessed;
}
-
@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;
}
-
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);
+ 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;
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() {
+ public Object getKey() {
return this.key;
}
-
@Override
public boolean isKeyEqual(Object k) {
if (k instanceof Integer) {
@@ -325,5 +373,8 @@ public class VMStatsDiskRegionEntryOffHeapIntKey extends VMStatsDiskRegionEntryO
}
return false;
}
+
+
// DO NOT modify this class. It was generated from LeafRegionEntry.cpp
}
+
http://git-wip-us.apache.org/repos/asf/geode/blob/30f455bb/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeapLongKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeapLongKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeapLongKey.java
index 62e6cc7..cc49d3f 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeapLongKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeapLongKey.java
@@ -15,74 +15,112 @@
package org.apache.geode.internal.cache;
// DO NOT modify this class. It was generated from LeafRegionEntry.cpp
+
+
+
+
+
+
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
+
import java.util.concurrent.atomic.AtomicLongFieldUpdater;
+
+
+
+
import org.apache.geode.internal.cache.lru.EnableLRU;
+
+
import org.apache.geode.internal.cache.persistence.DiskRecoveryStore;
+
+
import org.apache.geode.internal.InternalStatisticsDisabledException;
+
import org.apache.geode.internal.offheap.OffHeapRegionEntryHelper;
import org.apache.geode.internal.offheap.annotations.Released;
import org.apache.geode.internal.offheap.annotations.Retained;
import org.apache.geode.internal.offheap.annotations.Unretained;
+
import org.apache.geode.internal.util.concurrent.CustomEntryConcurrentHashMap.HashEntry;
// macros whose definition changes this class:
-// disk: DISK
+// disk: 1
// lru: LRU
-// stats: STATS
+// stats: 1
// versioned: VERSIONED
-// offheap: OFFHEAP
+// offheap: 1
// One of the following key macros must be defined:
// key object: KEY_OBJECT
// key int: KEY_INT
-// key long: KEY_LONG
+// key 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 VMStatsDiskRegionEntryOffHeapLongKey extends VMStatsDiskRegionEntryOffHeap {
- public VMStatsDiskRegionEntryOffHeapLongKey(RegionEntryContext context, long key,
- @Retained Object value) {
- super(context, (value instanceof RecoveredEntry ? null : value));
+ public VMStatsDiskRegionEntryOffHeapLongKey (RegionEntryContext context, long key,
+
+ @Retained
+
+ Object value
+
+
+
+ ) {
+ super(context,
+
+ (value instanceof RecoveredEntry ? null : value)
+
+
+
+ );
// DO NOT modify this class. It was generated from LeafRegionEntry.cpp
+
initialize(context, value);
+
+
+
+
+
+
this.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<VMStatsDiskRegionEntryOffHeapLongKey> lastModifiedUpdater =
- AtomicLongFieldUpdater.newUpdater(VMStatsDiskRegionEntryOffHeapLongKey.class, "lastModified");
+ private static final AtomicLongFieldUpdater<VMStatsDiskRegionEntryOffHeapLongKey> lastModifiedUpdater
+ = AtomicLongFieldUpdater.newUpdater(VMStatsDiskRegionEntryOffHeapLongKey.class, "lastModified");
+
/**
* All access done using ohAddrUpdater so it is used even though the compiler can not tell it is.
*/
@SuppressWarnings("unused")
- @Retained
- @Released
- private volatile long ohAddress;
+ @Retained @Released private volatile long ohAddress;
/**
- * I needed to add this because I wanted clear to call setValue which normally can only be called
- * while the re is synced. But if I sync in that code it causes a lock ordering deadlock with the
- * disk regions because they also get a rw lock in clear. Some hardware platforms do not support
- * CAS on a long. If gemfire is run on one of those the AtomicLongFieldUpdater does a sync on the
- * re and we will once again be deadlocked. I don't know if we support any of the hardware
- * platforms that do not have a 64bit CAS. If we do then we can expect deadlocks on disk regions.
+ * I needed to add this because I wanted clear to call setValue which normally can only be called while the re is synced.
+ * But if I sync in that code it causes a lock ordering deadlock with the disk regions because they also get a rw lock in clear.
+ * Some hardware platforms do not support CAS on a long. If gemfire is run on one of those the AtomicLongFieldUpdater does a sync
+ * on the re and we will once again be deadlocked.
+ * I don't know if we support any of the hardware platforms that do not have a 64bit CAS. If we do then we can expect deadlocks
+ * on disk regions.
*/
- private final static AtomicLongFieldUpdater<VMStatsDiskRegionEntryOffHeapLongKey> ohAddrUpdater =
- AtomicLongFieldUpdater.newUpdater(VMStatsDiskRegionEntryOffHeapLongKey.class, "ohAddress");
-
+ private final static AtomicLongFieldUpdater<VMStatsDiskRegionEntryOffHeapLongKey> ohAddrUpdater = AtomicLongFieldUpdater.newUpdater(VMStatsDiskRegionEntryOffHeapLongKey.class, "ohAddress");
+
@Override
public Token getValueAsToken() {
return OffHeapRegionEntryHelper.getValueAsToken(this);
}
-
+
@Override
protected Object getValueField() {
return OffHeapRegionEntryHelper._getValue(this);
@@ -90,13 +128,18 @@ public class VMStatsDiskRegionEntryOffHeapLongKey extends VMStatsDiskRegionEntry
// DO NOT modify this class. It was generated from LeafRegionEntry.cpp
@Override
+
@Unretained
protected void setValueField(@Unretained Object v) {
+
+
+
OffHeapRegionEntryHelper.setValue(this, v);
}
-
@Override
+
@Retained
+
public Object _getValueRetain(RegionEntryContext context, boolean decompress) {
return OffHeapRegionEntryHelper._getValueRetain(this, decompress, context);
}
@@ -110,71 +153,72 @@ public class VMStatsDiskRegionEntryOffHeapLongKey extends VMStatsDiskRegionEntry
public boolean setAddress(long expectedAddr, long newAddr) {
return ohAddrUpdater.compareAndSet(this, expectedAddr, newAddr);
}
-
+
@Override
+
@Released
+
public void release() {
OffHeapRegionEntryHelper.releaseEntry(this);
}
-
+
@Override
public void returnToPool() {
// Deadcoded for now; never was working
- // if (this instanceof VMThinRegionEntryLongKey) {
- // factory.returnToPool((VMThinRegionEntryLongKey)this);
- // }
+// if (this instanceof VMThinRegionEntryLongKey) {
+// factory.returnToPool((VMThinRegionEntryLongKey)this);
+// }
}
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() {
+ public int getEntryHash() {
return this.hash;
}
-
protected void setEntryHash(int v) {
this.hash = v;
}
-
/**
* @see HashEntry#getNextEntry()
*/
- public final HashEntry<Object, Object> getNextEntry() {
+ public HashEntry<Object, Object> getNextEntry() {
return this.next;
}
-
/**
* @see HashEntry#setNextEntry
*/
- public final void setNextEntry(final HashEntry<Object, Object> n) {
+ public void setNextEntry(final HashEntry<Object, Object> n) {
this.next = n;
}
+
// DO NOT modify this class. It was generated from LeafRegionEntry.cpp
+
// disk code
+
protected void initialize(RegionEntryContext context, Object value) {
diskInitialize(context, value);
}
-
@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);
}
@@ -184,60 +228,63 @@ public class VMStatsDiskRegionEntryOffHeapLongKey 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();
- }
-
- // // 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;
+ 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;
+
+
+
+
+
// 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();
@@ -245,79 +292,75 @@ public class VMStatsDiskRegionEntryOffHeapLongKey extends VMStatsDiskRegionEntry
incrementMissCount();
}
}
-
@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) {
+ 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<VMStatsDiskRegionEntryOffHeapLongKey> hitCountUpdater =
- AtomicIntegerFieldUpdater.newUpdater(VMStatsDiskRegionEntryOffHeapLongKey.class, "hitCount");
- private static final AtomicIntegerFieldUpdater<VMStatsDiskRegionEntryOffHeapLongKey> missCountUpdater =
- AtomicIntegerFieldUpdater.newUpdater(VMStatsDiskRegionEntryOffHeapLongKey.class, "missCount");
-
+
+ private static final AtomicIntegerFieldUpdater<VMStatsDiskRegionEntryOffHeapLongKey> hitCountUpdater
+ = AtomicIntegerFieldUpdater.newUpdater(VMStatsDiskRegionEntryOffHeapLongKey.class, "hitCount");
+ private static final AtomicIntegerFieldUpdater<VMStatsDiskRegionEntryOffHeapLongKey> missCountUpdater
+ = AtomicIntegerFieldUpdater.newUpdater(VMStatsDiskRegionEntryOffHeapLongKey.class, "missCount");
+
@Override
- public final long getLastAccessed() throws InternalStatisticsDisabledException {
+ public long getLastAccessed() throws InternalStatisticsDisabledException {
return this.lastAccessed;
}
-
private void setLastAccessed(long lastAccessed) {
this.lastAccessed = lastAccessed;
}
-
@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;
}
-
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);
+ 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;
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() {
+ public Object getKey() {
return this.key;
}
-
@Override
public boolean isKeyEqual(Object k) {
if (k instanceof Long) {
@@ -325,5 +368,8 @@ public class VMStatsDiskRegionEntryOffHeapLongKey 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/30f455bb/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeapObjectKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeapObjectKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeapObjectKey.java
index 5cde18e..867edf3 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeapObjectKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeapObjectKey.java
@@ -15,75 +15,108 @@
package org.apache.geode.internal.cache;
// DO NOT modify this class. It was generated from LeafRegionEntry.cpp
+
+
+
+
+
+
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
+
import java.util.concurrent.atomic.AtomicLongFieldUpdater;
+
+
+
+
import org.apache.geode.internal.cache.lru.EnableLRU;
+
+
import org.apache.geode.internal.cache.persistence.DiskRecoveryStore;
+
+
import org.apache.geode.internal.InternalStatisticsDisabledException;
+
import org.apache.geode.internal.offheap.OffHeapRegionEntryHelper;
import org.apache.geode.internal.offheap.annotations.Released;
import org.apache.geode.internal.offheap.annotations.Retained;
import org.apache.geode.internal.offheap.annotations.Unretained;
+
import org.apache.geode.internal.util.concurrent.CustomEntryConcurrentHashMap.HashEntry;
// macros whose definition changes this class:
-// disk: DISK
+// disk: 1
// lru: LRU
-// stats: STATS
+// stats: 1
// versioned: VERSIONED
-// offheap: OFFHEAP
+// offheap: 1
// One of the following key macros must be defined:
-// key object: KEY_OBJECT
+// key object: 1
// key int: KEY_INT
// key long: KEY_LONG
// key uuid: KEY_UUID
// key string1: KEY_STRING1
// key string2: KEY_STRING2
+
/**
* Do not modify this class. It was generated. Instead modify LeafRegionEntry.cpp and then run
* ./dev-tools/generateRegionEntryClasses.sh (it must be run from the top level directory).
*/
public class VMStatsDiskRegionEntryOffHeapObjectKey extends VMStatsDiskRegionEntryOffHeap {
- public VMStatsDiskRegionEntryOffHeapObjectKey(RegionEntryContext context, Object key,
- @Retained Object value) {
- super(context, (value instanceof RecoveredEntry ? null : value));
+ public VMStatsDiskRegionEntryOffHeapObjectKey (RegionEntryContext context, Object key,
+
+ @Retained
+
+ Object value
+
+
+
+ ) {
+ super(context,
+
+ (value instanceof RecoveredEntry ? null : value)
+
+
+
+ );
// DO NOT modify this class. It was generated from LeafRegionEntry.cpp
+
initialize(context, value);
+
+
this.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<VMStatsDiskRegionEntryOffHeapObjectKey> lastModifiedUpdater =
- AtomicLongFieldUpdater.newUpdater(VMStatsDiskRegionEntryOffHeapObjectKey.class,
- "lastModified");
+ private static final AtomicLongFieldUpdater<VMStatsDiskRegionEntryOffHeapObjectKey> lastModifiedUpdater
+ = AtomicLongFieldUpdater.newUpdater(VMStatsDiskRegionEntryOffHeapObjectKey.class, "lastModified");
+
/**
* All access done using ohAddrUpdater so it is used even though the compiler can not tell it is.
*/
@SuppressWarnings("unused")
- @Retained
- @Released
- private volatile long ohAddress;
+ @Retained @Released private volatile long ohAddress;
/**
- * I needed to add this because I wanted clear to call setValue which normally can only be called
- * while the re is synced. But if I sync in that code it causes a lock ordering deadlock with the
- * disk regions because they also get a rw lock in clear. Some hardware platforms do not support
- * CAS on a long. If gemfire is run on one of those the AtomicLongFieldUpdater does a sync on the
- * re and we will once again be deadlocked. I don't know if we support any of the hardware
- * platforms that do not have a 64bit CAS. If we do then we can expect deadlocks on disk regions.
+ * I needed to add this because I wanted clear to call setValue which normally can only be called while the re is synced.
+ * But if I sync in that code it causes a lock ordering deadlock with the disk regions because they also get a rw lock in clear.
+ * Some hardware platforms do not support CAS on a long. If gemfire is run on one of those the AtomicLongFieldUpdater does a sync
+ * on the re and we will once again be deadlocked.
+ * I don't know if we support any of the hardware platforms that do not have a 64bit CAS. If we do then we can expect deadlocks
+ * on disk regions.
*/
- private final static AtomicLongFieldUpdater<VMStatsDiskRegionEntryOffHeapObjectKey> ohAddrUpdater =
- AtomicLongFieldUpdater.newUpdater(VMStatsDiskRegionEntryOffHeapObjectKey.class, "ohAddress");
-
+ private final static AtomicLongFieldUpdater<VMStatsDiskRegionEntryOffHeapObjectKey> ohAddrUpdater = AtomicLongFieldUpdater.newUpdater(VMStatsDiskRegionEntryOffHeapObjectKey.class, "ohAddress");
+
@Override
public Token getValueAsToken() {
return OffHeapRegionEntryHelper.getValueAsToken(this);
}
-
+
@Override
protected Object getValueField() {
return OffHeapRegionEntryHelper._getValue(this);
@@ -91,13 +124,18 @@ public class VMStatsDiskRegionEntryOffHeapObjectKey extends VMStatsDiskRegionEnt
// DO NOT modify this class. It was generated from LeafRegionEntry.cpp
@Override
+
@Unretained
protected void setValueField(@Unretained Object v) {
+
+
+
OffHeapRegionEntryHelper.setValue(this, v);
}
-
@Override
+
@Retained
+
public Object _getValueRetain(RegionEntryContext context, boolean decompress) {
return OffHeapRegionEntryHelper._getValueRetain(this, decompress, context);
}
@@ -111,71 +149,72 @@ public class VMStatsDiskRegionEntryOffHeapObjectKey extends VMStatsDiskRegionEnt
public boolean setAddress(long expectedAddr, long newAddr) {
return ohAddrUpdater.compareAndSet(this, expectedAddr, newAddr);
}
-
+
@Override
+
@Released
+
public void release() {
OffHeapRegionEntryHelper.releaseEntry(this);
}
-
+
@Override
public void returnToPool() {
// Deadcoded for now; never was working
- // if (this instanceof VMThinRegionEntryLongKey) {
- // factory.returnToPool((VMThinRegionEntryLongKey)this);
- // }
+// if (this instanceof VMThinRegionEntryLongKey) {
+// factory.returnToPool((VMThinRegionEntryLongKey)this);
+// }
}
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() {
+ public int getEntryHash() {
return this.hash;
}
-
protected void setEntryHash(int v) {
this.hash = v;
}
-
/**
* @see HashEntry#getNextEntry()
*/
- public final HashEntry<Object, Object> getNextEntry() {
+ public HashEntry<Object, Object> getNextEntry() {
return this.next;
}
-
/**
* @see HashEntry#setNextEntry
*/
- public final void setNextEntry(final HashEntry<Object, Object> n) {
+ public void setNextEntry(final HashEntry<Object, Object> n) {
this.next = n;
}
+
// DO NOT modify this class. It was generated from LeafRegionEntry.cpp
+
// disk code
+
protected void initialize(RegionEntryContext context, Object value) {
diskInitialize(context, value);
}
-
@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);
}
@@ -185,60 +224,63 @@ public class VMStatsDiskRegionEntryOffHeapObjectKey extends VMStatsDiskRegionEnt
*
* @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();
- }
-
- // // 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;
+ 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;
+
+
+
+
+
// 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();
@@ -246,79 +288,77 @@ public class VMStatsDiskRegionEntryOffHeapObjectKey extends VMStatsDiskRegionEnt
incrementMissCount();
}
}
-
@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) {
+ 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<VMStatsDiskRegionEntryOffHeapObjectKey> hitCountUpdater =
- AtomicIntegerFieldUpdater.newUpdater(VMStatsDiskRegionEntryOffHeapObjectKey.class,
- "hitCount");
- private static final AtomicIntegerFieldUpdater<VMStatsDiskRegionEntryOffHeapObjectKey> missCountUpdater =
- AtomicIntegerFieldUpdater.newUpdater(VMStatsDiskRegionEntryOffHeapObjectKey.class,
- "missCount");
-
+
+ private static final AtomicIntegerFieldUpdater<VMStatsDiskRegionEntryOffHeapObjectKey> hitCountUpdater
+ = AtomicIntegerFieldUpdater.newUpdater(VMStatsDiskRegionEntryOffHeapObjectKey.class, "hitCount");
+ private static final AtomicIntegerFieldUpdater<VMStatsDiskRegionEntryOffHeapObjectKey> missCountUpdater
+ = AtomicIntegerFieldUpdater.newUpdater(VMStatsDiskRegionEntryOffHeapObjectKey.class, "missCount");
+
@Override
- public final long getLastAccessed() throws InternalStatisticsDisabledException {
+ public long getLastAccessed() throws InternalStatisticsDisabledException {
return this.lastAccessed;
}
-
private void setLastAccessed(long lastAccessed) {
this.lastAccessed = lastAccessed;
}
-
@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;
}
-
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);
+ 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;
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() {
+ 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/30f455bb/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeapStringKey1.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeapStringKey1.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeapStringKey1.java
index c42095c..abab88f 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeapStringKey1.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsDiskRegionEntryOffHeapStringKey1.java
@@ -15,92 +15,123 @@
package org.apache.geode.internal.cache;
// DO NOT modify this class. It was generated from LeafRegionEntry.cpp
+
+
+
+
+
+
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
+
import java.util.concurrent.atomic.AtomicLongFieldUpdater;
+
+
+
+
import org.apache.geode.internal.cache.lru.EnableLRU;
+
+
import org.apache.geode.internal.cache.persistence.DiskRecoveryStore;
+
+
import org.apache.geode.internal.InternalStatisticsDisabledException;
+
import org.apache.geode.internal.offheap.OffHeapRegionEntryHelper;
import org.apache.geode.internal.offheap.annotations.Released;
import org.apache.geode.internal.offheap.annotations.Retained;
import org.apache.geode.internal.offheap.annotations.Unretained;
+
import org.apache.geode.internal.util.concurrent.CustomEntryConcurrentHashMap.HashEntry;
// macros whose definition changes this class:
-// disk: DISK
+// disk: 1
// lru: LRU
-// stats: STATS
+// stats: 1
// versioned: VERSIONED
-// offheap: OFFHEAP
+// offheap: 1
// One of the following key macros must be defined:
// key object: KEY_OBJECT
// key int: KEY_INT
// key long: KEY_LONG
// key uuid: KEY_UUID
-// key string1: KEY_STRING1
+// key string1: 1
// key string2: KEY_STRING2
+
/**
* Do not modify this class. It was generated. Instead modify LeafRegionEntry.cpp and then run
* ./dev-tools/generateRegionEntryClasses.sh (it must be run from the top level directory).
*/
public class VMStatsDiskRegionEntryOffHeapStringKey1 extends VMStatsDiskRegionEntryOffHeap {
- public VMStatsDiskRegionEntryOffHeapStringKey1(RegionEntryContext context, String key,
- @Retained Object value, boolean byteEncode) {
- super(context, (value instanceof RecoveredEntry ? null : value));
+ public VMStatsDiskRegionEntryOffHeapStringKey1 (RegionEntryContext context, String key,
+
+ @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) {
- 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<VMStatsDiskRegionEntryOffHeapStringKey1> lastModifiedUpdater =
- AtomicLongFieldUpdater.newUpdater(VMStatsDiskRegionEntryOffHeapStringKey1.class,
- "lastModified");
+ private static final AtomicLongFieldUpdater<VMStatsDiskRegionEntryOffHeapStringKey1> lastModifiedUpdater
+ = AtomicLongFieldUpdater.newUpdater(VMStatsDiskRegionEntryOffHeapStringKey1.class, "lastModified");
+
/**
* All access done using ohAddrUpdater so it is used even though the compiler can not tell it is.
*/
@SuppressWarnings("unused")
- @Retained
- @Released
- private volatile long ohAddress;
+ @Retained @Released private volatile long ohAddress;
/**
- * I needed to add this because I wanted clear to call setValue which normally can only be called
- * while the re is synced. But if I sync in that code it causes a lock ordering deadlock with the
- * disk regions because they also get a rw lock in clear. Some hardware platforms do not support
- * CAS on a long. If gemfire is run on one of those the AtomicLongFieldUpdater does a sync on the
- * re and we will once again be deadlocked. I don't know if we support any of the hardware
- * platforms that do not have a 64bit CAS. If we do then we can expect deadlocks on disk regions.
+ * I needed to add this because I wanted clear to call setValue which normally can only be called while the re is synced.
+ * But if I sync in that code it causes a lock ordering deadlock with the disk regions because they also get a rw lock in clear.
+ * Some hardware platforms do not support CAS on a long. If gemfire is run on one of those the AtomicLongFieldUpdater does a sync
+ * on the re and we will once again be deadlocked.
+ * I don't know if we support any of the hardware platforms that do not have a 64bit CAS. If we do then we can expect deadlocks
+ * on disk regions.
*/
- private final static AtomicLongFieldUpdater<VMStatsDiskRegionEntryOffHeapStringKey1> ohAddrUpdater =
- AtomicLongFieldUpdater.newUpdater(VMStatsDiskRegionEntryOffHeapStringKey1.class, "ohAddress");
-
+ private final static AtomicLongFieldUpdater<VMStatsDiskRegionEntryOffHeapStringKey1> ohAddrUpdater = AtomicLongFieldUpdater.newUpdater(VMStatsDiskRegionEntryOffHeapStringKey1.class, "ohAddress");
+
@Override
public Token getValueAsToken() {
return OffHeapRegionEntryHelper.getValueAsToken(this);
}
-
+
@Override
protected Object getValueField() {
return OffHeapRegionEntryHelper._getValue(this);
@@ -108,13 +139,18 @@ public class VMStatsDiskRegionEntryOffHeapStringKey1 extends VMStatsDiskRegionEn
// DO NOT modify this class. It was generated from LeafRegionEntry.cpp
@Override
+
@Unretained
protected void setValueField(@Unretained Object v) {
+
+
+
OffHeapRegionEntryHelper.setValue(this, v);
}
-
@Override
+
@Retained
+
public Object _getValueRetain(RegionEntryContext context, boolean decompress) {
return OffHeapRegionEntryHelper._getValueRetain(this, decompress, context);
}
@@ -128,71 +164,72 @@ public class VMStatsDiskRegionEntryOffHeapStringKey1 extends VMStatsDiskRegionEn
public boolean setAddress(long expectedAddr, long newAddr) {
return ohAddrUpdater.compareAndSet(this, expectedAddr, newAddr);
}
-
+
@Override
+
@Released
+
public void release() {
OffHeapRegionEntryHelper.releaseEntry(this);
}
-
+
@Override
public void returnToPool() {
// Deadcoded for now; never was working
- // if (this instanceof VMThinRegionEntryLongKey) {
- // factory.returnToPool((VMThinRegionEntryLongKey)this);
- // }
+// if (this instanceof VMThinRegionEntryLongKey) {
+// factory.returnToPool((VMThinRegionEntryLongKey)this);
+// }
}
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() {
+ public int getEntryHash() {
return this.hash;
}
-
protected void setEntryHash(int v) {
this.hash = v;
}
-
/**
* @see HashEntry#getNextEntry()
*/
- public final HashEntry<Object, Object> getNextEntry() {
+ public HashEntry<Object, Object> getNextEntry() {
return this.next;
}
-
/**
* @see HashEntry#setNextEntry
*/
- public final void setNextEntry(final HashEntry<Object, Object> n) {
+ public void setNextEntry(final HashEntry<Object, Object> n) {
this.next = n;
}
+
// DO NOT modify this class. It was generated from LeafRegionEntry.cpp
+
// disk code
+
protected void initialize(RegionEntryContext context, Object value) {
diskInitialize(context, value);
}
-
@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);
}
@@ -202,60 +239,63 @@ public class VMStatsDiskRegionEntryOffHeapStringKey1 extends VMStatsDiskRegionEn
*
* @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();
- }
-
- // // 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;
+ 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;
+
+
+
+
+
// 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();
@@ -263,98 +303,91 @@ public class VMStatsDiskRegionEntryOffHeapStringKey1 extends VMStatsDiskRegionEn
incrementMissCount();
}
}
-
@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) {
+ 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<VMStatsDiskRegionEntryOffHeapStringKey1> hitCountUpdater =
- AtomicIntegerFieldUpdater.newUpdater(VMStatsDiskRegionEntryOffHeapStringKey1.class,
- "hitCount");
- private static final AtomicIntegerFieldUpdater<VMStatsDiskRegionEntryOffHeapStringKey1> missCountUpdater =
- AtomicIntegerFieldUpdater.newUpdater(VMStatsDiskRegionEntryOffHeapStringKey1.class,
- "missCount");
-
+
+ private static final AtomicIntegerFieldUpdater<VMStatsDiskRegionEntryOffHeapStringKey1> hitCountUpdater
+ = AtomicIntegerFieldUpdater.newUpdater(VMStatsDiskRegionEntryOffHeapStringKey1.class, "hitCount");
+ private static final AtomicIntegerFieldUpdater<VMStatsDiskRegionEntryOffHeapStringKey1> missCountUpdater
+ = AtomicIntegerFieldUpdater.newUpdater(VMStatsDiskRegionEntryOffHeapStringKey1.class, "missCount");
+
@Override
- public final long getLastAccessed() throws InternalStatisticsDisabledException {
+ public long getLastAccessed() throws InternalStatisticsDisabledException {
return this.lastAccessed;
}
-
private void setLastAccessed(long lastAccessed) {
this.lastAccessed = lastAccessed;
}
-
@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;
}
-
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);
+ 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;
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() {
+ public 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);
}
@@ -363,15 +396,16 @@ public class VMStatsDiskRegionEntryOffHeapStringKey1 extends VMStatsDiskRegionEn
}
// DO NOT modify this class. It was generated from LeafRegionEntry.cpp
+
@Override
public boolean isKeyEqual(Object k) {
if (k instanceof String) {
- 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) {
@@ -379,7 +413,7 @@ public class VMStatsDiskRegionEntryOffHeapStringKey1 extends VMStatsDiskRegionEn
}
}
} 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) {
@@ -392,5 +426,8 @@ public class VMStatsDiskRegionEntryOffHeapStringKey1 extends VMStatsDiskRegionEn
}
return false;
}
+
+
// DO NOT modify this class. It was generated from LeafRegionEntry.cpp
}
+