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:20:21 UTC
[71/78] geode git commit: fixup
http://git-wip-us.apache.org/repos/asf/geode/blob/5adb681a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryOffHeapIntKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryOffHeapIntKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryOffHeapIntKey.java
index 3d51a7a..d01167b 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryOffHeapIntKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryOffHeapIntKey.java
@@ -18,35 +18,17 @@ package org.apache.geode.internal.cache;
-
-
-
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
import java.util.concurrent.atomic.AtomicLongFieldUpdater;
-
-
-
import org.apache.geode.internal.cache.lru.EnableLRU;
-
-
-
-
import org.apache.geode.internal.InternalStatisticsDisabledException;
-
import org.apache.geode.internal.cache.lru.LRUClockNode;
import org.apache.geode.internal.cache.lru.NewLRUClockHand;
-
-
-
-
-
-
-
import org.apache.geode.internal.offheap.OffHeapRegionEntryHelper;
import org.apache.geode.internal.offheap.annotations.Released;
import org.apache.geode.internal.offheap.annotations.Retained;
@@ -73,7 +55,7 @@ import org.apache.geode.internal.util.concurrent.CustomEntryConcurrentHashMap.Ha
* ./dev-tools/generateRegionEntryClasses.sh (it must be run from the top level directory).
*/
public class VMStatsLRURegionEntryOffHeapIntKey extends VMStatsLRURegionEntryOffHeap {
- public VMStatsLRURegionEntryOffHeapIntKey (RegionEntryContext context, int key,
+ public VMStatsLRURegionEntryOffHeapIntKey(RegionEntryContext context, int key,
@Retained
@@ -81,55 +63,55 @@ public class VMStatsLRURegionEntryOffHeapIntKey extends VMStatsLRURegionEntryOff
- ) {
- super(context,
+ ) {
+ super(context,
- value
+ value
- );
+ );
// DO NOT modify this class. It was generated from LeafRegionEntry.cpp
-
-
-
this.key = key;
}
// DO NOT modify this class. It was generated from LeafRegionEntry.cpp
-
+
// common code
protected int hash;
private HashEntry<Object, Object> next;
@SuppressWarnings("unused")
private volatile long lastModified;
- private static final AtomicLongFieldUpdater<VMStatsLRURegionEntryOffHeapIntKey> lastModifiedUpdater
- = AtomicLongFieldUpdater.newUpdater(VMStatsLRURegionEntryOffHeapIntKey.class, "lastModified");
+ private static final AtomicLongFieldUpdater<VMStatsLRURegionEntryOffHeapIntKey> lastModifiedUpdater =
+ AtomicLongFieldUpdater.newUpdater(VMStatsLRURegionEntryOffHeapIntKey.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<VMStatsLRURegionEntryOffHeapIntKey> ohAddrUpdater = AtomicLongFieldUpdater.newUpdater(VMStatsLRURegionEntryOffHeapIntKey.class, "ohAddress");
-
+ private final static AtomicLongFieldUpdater<VMStatsLRURegionEntryOffHeapIntKey> ohAddrUpdater =
+ AtomicLongFieldUpdater.newUpdater(VMStatsLRURegionEntryOffHeapIntKey.class, "ohAddress");
+
@Override
public Token getValueAsToken() {
return OffHeapRegionEntryHelper.getValueAsToken(this);
}
-
+
@Override
protected Object getValueField() {
return OffHeapRegionEntryHelper._getValue(this);
@@ -145,6 +127,7 @@ public class VMStatsLRURegionEntryOffHeapIntKey extends VMStatsLRURegionEntryOff
OffHeapRegionEntryHelper.setValue(this, v);
}
+
@Override
@Retained
@@ -162,7 +145,7 @@ public class VMStatsLRURegionEntryOffHeapIntKey extends VMStatsLRURegionEntryOff
public boolean setAddress(long expectedAddr, long newAddr) {
return ohAddrUpdater.compareAndSet(this, expectedAddr, newAddr);
}
-
+
@Override
@Released
@@ -170,36 +153,41 @@ public class VMStatsLRURegionEntryOffHeapIntKey extends VMStatsLRURegionEntryOff
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 int getEntryHash() {
return this.hash;
}
+
protected void setEntryHash(int v) {
this.hash = v;
}
+
/**
* @see HashEntry#getNextEntry()
*/
public HashEntry<Object, Object> getNextEntry() {
return this.next;
}
+
/**
* @see HashEntry#setNextEntry
*/
@@ -207,51 +195,57 @@ public class VMStatsLRURegionEntryOffHeapIntKey extends VMStatsLRURegionEntryOff
this.next = n;
}
-
+
// DO NOT modify this class. It was generated from LeafRegionEntry.cpp
-
+
// lru code
@Override
public void setDelayedDiskId(LocalRegion r) {
-
-
- // nothing needed for LRUs with no disk
+ // nothing needed for LRUs with no disk
}
+
public synchronized int updateEntrySize(EnableLRU capacityController) {
- return updateEntrySize(capacityController, _getValue()); // OFHEAP: _getValue ok w/o incing refcount because we are synced and only getting the size
+ return updateEntrySize(capacityController, _getValue()); // OFHEAP: _getValue ok w/o incing
+ // refcount because we are synced and
+ // only getting the size
}
-
+
// DO NOT modify this class. It was generated from LeafRegionEntry.cpp
-
- public synchronized int updateEntrySize(EnableLRU capacityController,
- Object value) {
+
+ public synchronized int updateEntrySize(EnableLRU capacityController, Object value) {
int oldSize = getEntrySize();
- int newSize = capacityController.entrySize( getKeyForSizing(), value);
+ int newSize = capacityController.entrySize(getKeyForSizing(), value);
setEntrySize(newSize);
int delta = newSize - oldSize;
return delta;
}
+
public boolean testRecentlyUsed() {
return areAnyBitsSet(RECENTLY_USED);
}
+
@Override
public void setRecentlyUsed() {
setBits(RECENTLY_USED);
}
+
public void unsetRecentlyUsed() {
clearBits(~RECENTLY_USED);
}
+
public boolean testEvicted() {
return areAnyBitsSet(EVICTED);
}
+
public void setEvicted() {
setBits(EVICTED);
}
+
public void unsetEvicted() {
clearBits(~EVICTED);
}
@@ -261,33 +255,38 @@ public class VMStatsLRURegionEntryOffHeapIntKey extends VMStatsLRURegionEntryOff
private LRUClockNode nextLRU;
private LRUClockNode prevLRU;
private int size;
- public void setNextLRUNode( LRUClockNode next ) {
+
+ public void setNextLRUNode(LRUClockNode next) {
this.nextLRU = next;
}
+
public LRUClockNode nextLRUNode() {
return this.nextLRU;
}
- public void setPrevLRUNode( LRUClockNode prev ) {
+
+ public void setPrevLRUNode(LRUClockNode prev) {
this.prevLRU = prev;
}
+
public LRUClockNode prevLRUNode() {
return this.prevLRU;
}
+
public int getEntrySize() {
return this.size;
}
+
protected void setEntrySize(int size) {
this.size = size;
}
// DO NOT modify this class. It was generated from LeafRegionEntry.cpp
-
+
@Override
public Object getKeyForSizing() {
-
// inline keys always report null for sizing since the size comes from the entry size
return null;
@@ -296,7 +295,7 @@ public class VMStatsLRURegionEntryOffHeapIntKey extends VMStatsLRURegionEntryOff
// DO NOT modify this class. It was generated from LeafRegionEntry.cpp
-
+
// stats code
@Override
public void updateStatsForGet(boolean hit, long time) {
@@ -307,51 +306,59 @@ public class VMStatsLRURegionEntryOffHeapIntKey extends VMStatsLRURegionEntryOff
incrementMissCount();
}
}
+
@Override
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<VMStatsLRURegionEntryOffHeapIntKey> hitCountUpdater
- = AtomicIntegerFieldUpdater.newUpdater(VMStatsLRURegionEntryOffHeapIntKey.class, "hitCount");
- private static final AtomicIntegerFieldUpdater<VMStatsLRURegionEntryOffHeapIntKey> missCountUpdater
- = AtomicIntegerFieldUpdater.newUpdater(VMStatsLRURegionEntryOffHeapIntKey.class, "missCount");
-
+
+ private static final AtomicIntegerFieldUpdater<VMStatsLRURegionEntryOffHeapIntKey> hitCountUpdater =
+ AtomicIntegerFieldUpdater.newUpdater(VMStatsLRURegionEntryOffHeapIntKey.class, "hitCount");
+ private static final AtomicIntegerFieldUpdater<VMStatsLRURegionEntryOffHeapIntKey> missCountUpdater =
+ AtomicIntegerFieldUpdater.newUpdater(VMStatsLRURegionEntryOffHeapIntKey.class, "missCount");
+
@Override
public long getLastAccessed() throws InternalStatisticsDisabledException {
return this.lastAccessed;
}
+
private void setLastAccessed(long lastAccessed) {
this.lastAccessed = lastAccessed;
}
+
@Override
public long getHitCount() throws InternalStatisticsDisabledException {
return this.hitCount & 0xFFFFFFFFL;
}
+
@Override
public long getMissCount() throws InternalStatisticsDisabledException {
return this.missCount & 0xFFFFFFFFL;
}
+
private void incrementHitCount() {
hitCountUpdater.incrementAndGet(this);
}
+
private void incrementMissCount() {
missCountUpdater.incrementAndGet(this);
}
+
@Override
public 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 void txDidDestroy(long currTime) {
setLastModified(currTime);
@@ -359,30 +366,27 @@ public class VMStatsLRURegionEntryOffHeapIntKey extends VMStatsLRURegionEntryOff
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
-
-
+ // DO NOT modify this class. It was generated from LeafRegionEntry.cpp
+ // key code
private final int key;
+
@Override
public Object getKey() {
return this.key;
}
+
@Override
public boolean isKeyEqual(Object k) {
if (k instanceof Integer) {
@@ -390,7 +394,7 @@ public class VMStatsLRURegionEntryOffHeapIntKey extends VMStatsLRURegionEntryOff
}
return false;
}
-
+
// DO NOT modify this class. It was generated from LeafRegionEntry.cpp
}
http://git-wip-us.apache.org/repos/asf/geode/blob/5adb681a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryOffHeapLongKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryOffHeapLongKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryOffHeapLongKey.java
index 31a2165..51747da 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryOffHeapLongKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryOffHeapLongKey.java
@@ -18,35 +18,17 @@ package org.apache.geode.internal.cache;
-
-
-
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
import java.util.concurrent.atomic.AtomicLongFieldUpdater;
-
-
-
import org.apache.geode.internal.cache.lru.EnableLRU;
-
-
-
-
import org.apache.geode.internal.InternalStatisticsDisabledException;
-
import org.apache.geode.internal.cache.lru.LRUClockNode;
import org.apache.geode.internal.cache.lru.NewLRUClockHand;
-
-
-
-
-
-
-
import org.apache.geode.internal.offheap.OffHeapRegionEntryHelper;
import org.apache.geode.internal.offheap.annotations.Released;
import org.apache.geode.internal.offheap.annotations.Retained;
@@ -73,7 +55,7 @@ import org.apache.geode.internal.util.concurrent.CustomEntryConcurrentHashMap.Ha
* ./dev-tools/generateRegionEntryClasses.sh (it must be run from the top level directory).
*/
public class VMStatsLRURegionEntryOffHeapLongKey extends VMStatsLRURegionEntryOffHeap {
- public VMStatsLRURegionEntryOffHeapLongKey (RegionEntryContext context, long key,
+ public VMStatsLRURegionEntryOffHeapLongKey(RegionEntryContext context, long key,
@Retained
@@ -81,57 +63,55 @@ public class VMStatsLRURegionEntryOffHeapLongKey extends VMStatsLRURegionEntryOf
- ) {
- super(context,
+ ) {
+ super(context,
- value
+ value
- );
+ );
// DO NOT modify this class. It was generated from LeafRegionEntry.cpp
-
-
-
-
-
this.key = key;
}
// DO NOT modify this class. It was generated from LeafRegionEntry.cpp
-
+
// common code
protected int hash;
private HashEntry<Object, Object> next;
@SuppressWarnings("unused")
private volatile long lastModified;
- private static final AtomicLongFieldUpdater<VMStatsLRURegionEntryOffHeapLongKey> lastModifiedUpdater
- = AtomicLongFieldUpdater.newUpdater(VMStatsLRURegionEntryOffHeapLongKey.class, "lastModified");
+ private static final AtomicLongFieldUpdater<VMStatsLRURegionEntryOffHeapLongKey> lastModifiedUpdater =
+ AtomicLongFieldUpdater.newUpdater(VMStatsLRURegionEntryOffHeapLongKey.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<VMStatsLRURegionEntryOffHeapLongKey> ohAddrUpdater = AtomicLongFieldUpdater.newUpdater(VMStatsLRURegionEntryOffHeapLongKey.class, "ohAddress");
-
+ private final static AtomicLongFieldUpdater<VMStatsLRURegionEntryOffHeapLongKey> ohAddrUpdater =
+ AtomicLongFieldUpdater.newUpdater(VMStatsLRURegionEntryOffHeapLongKey.class, "ohAddress");
+
@Override
public Token getValueAsToken() {
return OffHeapRegionEntryHelper.getValueAsToken(this);
}
-
+
@Override
protected Object getValueField() {
return OffHeapRegionEntryHelper._getValue(this);
@@ -147,6 +127,7 @@ public class VMStatsLRURegionEntryOffHeapLongKey extends VMStatsLRURegionEntryOf
OffHeapRegionEntryHelper.setValue(this, v);
}
+
@Override
@Retained
@@ -164,7 +145,7 @@ public class VMStatsLRURegionEntryOffHeapLongKey extends VMStatsLRURegionEntryOf
public boolean setAddress(long expectedAddr, long newAddr) {
return ohAddrUpdater.compareAndSet(this, expectedAddr, newAddr);
}
-
+
@Override
@Released
@@ -172,36 +153,41 @@ public class VMStatsLRURegionEntryOffHeapLongKey extends VMStatsLRURegionEntryOf
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 int getEntryHash() {
return this.hash;
}
+
protected void setEntryHash(int v) {
this.hash = v;
}
+
/**
* @see HashEntry#getNextEntry()
*/
public HashEntry<Object, Object> getNextEntry() {
return this.next;
}
+
/**
* @see HashEntry#setNextEntry
*/
@@ -209,51 +195,57 @@ public class VMStatsLRURegionEntryOffHeapLongKey extends VMStatsLRURegionEntryOf
this.next = n;
}
-
+
// DO NOT modify this class. It was generated from LeafRegionEntry.cpp
-
+
// lru code
@Override
public void setDelayedDiskId(LocalRegion r) {
-
-
- // nothing needed for LRUs with no disk
+ // nothing needed for LRUs with no disk
}
+
public synchronized int updateEntrySize(EnableLRU capacityController) {
- return updateEntrySize(capacityController, _getValue()); // OFHEAP: _getValue ok w/o incing refcount because we are synced and only getting the size
+ return updateEntrySize(capacityController, _getValue()); // OFHEAP: _getValue ok w/o incing
+ // refcount because we are synced and
+ // only getting the size
}
-
+
// DO NOT modify this class. It was generated from LeafRegionEntry.cpp
-
- public synchronized int updateEntrySize(EnableLRU capacityController,
- Object value) {
+
+ public synchronized int updateEntrySize(EnableLRU capacityController, Object value) {
int oldSize = getEntrySize();
- int newSize = capacityController.entrySize( getKeyForSizing(), value);
+ int newSize = capacityController.entrySize(getKeyForSizing(), value);
setEntrySize(newSize);
int delta = newSize - oldSize;
return delta;
}
+
public boolean testRecentlyUsed() {
return areAnyBitsSet(RECENTLY_USED);
}
+
@Override
public void setRecentlyUsed() {
setBits(RECENTLY_USED);
}
+
public void unsetRecentlyUsed() {
clearBits(~RECENTLY_USED);
}
+
public boolean testEvicted() {
return areAnyBitsSet(EVICTED);
}
+
public void setEvicted() {
setBits(EVICTED);
}
+
public void unsetEvicted() {
clearBits(~EVICTED);
}
@@ -263,33 +255,38 @@ public class VMStatsLRURegionEntryOffHeapLongKey extends VMStatsLRURegionEntryOf
private LRUClockNode nextLRU;
private LRUClockNode prevLRU;
private int size;
- public void setNextLRUNode( LRUClockNode next ) {
+
+ public void setNextLRUNode(LRUClockNode next) {
this.nextLRU = next;
}
+
public LRUClockNode nextLRUNode() {
return this.nextLRU;
}
- public void setPrevLRUNode( LRUClockNode prev ) {
+
+ public void setPrevLRUNode(LRUClockNode prev) {
this.prevLRU = prev;
}
+
public LRUClockNode prevLRUNode() {
return this.prevLRU;
}
+
public int getEntrySize() {
return this.size;
}
+
protected void setEntrySize(int size) {
this.size = size;
}
// DO NOT modify this class. It was generated from LeafRegionEntry.cpp
-
+
@Override
public Object getKeyForSizing() {
-
// inline keys always report null for sizing since the size comes from the entry size
return null;
@@ -298,7 +295,7 @@ public class VMStatsLRURegionEntryOffHeapLongKey extends VMStatsLRURegionEntryOf
// DO NOT modify this class. It was generated from LeafRegionEntry.cpp
-
+
// stats code
@Override
public void updateStatsForGet(boolean hit, long time) {
@@ -309,51 +306,59 @@ public class VMStatsLRURegionEntryOffHeapLongKey extends VMStatsLRURegionEntryOf
incrementMissCount();
}
}
+
@Override
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<VMStatsLRURegionEntryOffHeapLongKey> hitCountUpdater
- = AtomicIntegerFieldUpdater.newUpdater(VMStatsLRURegionEntryOffHeapLongKey.class, "hitCount");
- private static final AtomicIntegerFieldUpdater<VMStatsLRURegionEntryOffHeapLongKey> missCountUpdater
- = AtomicIntegerFieldUpdater.newUpdater(VMStatsLRURegionEntryOffHeapLongKey.class, "missCount");
-
+
+ private static final AtomicIntegerFieldUpdater<VMStatsLRURegionEntryOffHeapLongKey> hitCountUpdater =
+ AtomicIntegerFieldUpdater.newUpdater(VMStatsLRURegionEntryOffHeapLongKey.class, "hitCount");
+ private static final AtomicIntegerFieldUpdater<VMStatsLRURegionEntryOffHeapLongKey> missCountUpdater =
+ AtomicIntegerFieldUpdater.newUpdater(VMStatsLRURegionEntryOffHeapLongKey.class, "missCount");
+
@Override
public long getLastAccessed() throws InternalStatisticsDisabledException {
return this.lastAccessed;
}
+
private void setLastAccessed(long lastAccessed) {
this.lastAccessed = lastAccessed;
}
+
@Override
public long getHitCount() throws InternalStatisticsDisabledException {
return this.hitCount & 0xFFFFFFFFL;
}
+
@Override
public long getMissCount() throws InternalStatisticsDisabledException {
return this.missCount & 0xFFFFFFFFL;
}
+
private void incrementHitCount() {
hitCountUpdater.incrementAndGet(this);
}
+
private void incrementMissCount() {
missCountUpdater.incrementAndGet(this);
}
+
@Override
public 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 void txDidDestroy(long currTime) {
setLastModified(currTime);
@@ -361,23 +366,25 @@ public class VMStatsLRURegionEntryOffHeapLongKey extends VMStatsLRURegionEntryOf
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;
+
@Override
public Object getKey() {
return this.key;
}
+
@Override
public boolean isKeyEqual(Object k) {
if (k instanceof Long) {
@@ -385,7 +392,7 @@ public class VMStatsLRURegionEntryOffHeapLongKey extends VMStatsLRURegionEntryOf
}
return false;
}
-
+
// DO NOT modify this class. It was generated from LeafRegionEntry.cpp
}
http://git-wip-us.apache.org/repos/asf/geode/blob/5adb681a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryOffHeapObjectKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryOffHeapObjectKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryOffHeapObjectKey.java
index 755daf7..1c96722 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryOffHeapObjectKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryOffHeapObjectKey.java
@@ -18,35 +18,17 @@ package org.apache.geode.internal.cache;
-
-
-
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
import java.util.concurrent.atomic.AtomicLongFieldUpdater;
-
-
-
import org.apache.geode.internal.cache.lru.EnableLRU;
-
-
-
-
import org.apache.geode.internal.InternalStatisticsDisabledException;
-
import org.apache.geode.internal.cache.lru.LRUClockNode;
import org.apache.geode.internal.cache.lru.NewLRUClockHand;
-
-
-
-
-
-
-
import org.apache.geode.internal.offheap.OffHeapRegionEntryHelper;
import org.apache.geode.internal.offheap.annotations.Released;
import org.apache.geode.internal.offheap.annotations.Retained;
@@ -73,7 +55,7 @@ import org.apache.geode.internal.util.concurrent.CustomEntryConcurrentHashMap.Ha
* ./dev-tools/generateRegionEntryClasses.sh (it must be run from the top level directory).
*/
public class VMStatsLRURegionEntryOffHeapObjectKey extends VMStatsLRURegionEntryOffHeap {
- public VMStatsLRURegionEntryOffHeapObjectKey (RegionEntryContext context, Object key,
+ public VMStatsLRURegionEntryOffHeapObjectKey(RegionEntryContext context, Object key,
@Retained
@@ -81,53 +63,56 @@ public class VMStatsLRURegionEntryOffHeapObjectKey extends VMStatsLRURegionEntry
- ) {
- super(context,
+ ) {
+ super(context,
- value
+ value
- );
+ );
// DO NOT modify this class. It was generated from LeafRegionEntry.cpp
-
this.key = key;
}
// DO NOT modify this class. It was generated from LeafRegionEntry.cpp
-
+
// common code
protected int hash;
private HashEntry<Object, Object> next;
@SuppressWarnings("unused")
private volatile long lastModified;
- private static final AtomicLongFieldUpdater<VMStatsLRURegionEntryOffHeapObjectKey> lastModifiedUpdater
- = AtomicLongFieldUpdater.newUpdater(VMStatsLRURegionEntryOffHeapObjectKey.class, "lastModified");
+ private static final AtomicLongFieldUpdater<VMStatsLRURegionEntryOffHeapObjectKey> lastModifiedUpdater =
+ AtomicLongFieldUpdater.newUpdater(VMStatsLRURegionEntryOffHeapObjectKey.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<VMStatsLRURegionEntryOffHeapObjectKey> ohAddrUpdater = AtomicLongFieldUpdater.newUpdater(VMStatsLRURegionEntryOffHeapObjectKey.class, "ohAddress");
-
+ private final static AtomicLongFieldUpdater<VMStatsLRURegionEntryOffHeapObjectKey> ohAddrUpdater =
+ AtomicLongFieldUpdater.newUpdater(VMStatsLRURegionEntryOffHeapObjectKey.class, "ohAddress");
+
@Override
public Token getValueAsToken() {
return OffHeapRegionEntryHelper.getValueAsToken(this);
}
-
+
@Override
protected Object getValueField() {
return OffHeapRegionEntryHelper._getValue(this);
@@ -143,6 +128,7 @@ public class VMStatsLRURegionEntryOffHeapObjectKey extends VMStatsLRURegionEntry
OffHeapRegionEntryHelper.setValue(this, v);
}
+
@Override
@Retained
@@ -160,7 +146,7 @@ public class VMStatsLRURegionEntryOffHeapObjectKey extends VMStatsLRURegionEntry
public boolean setAddress(long expectedAddr, long newAddr) {
return ohAddrUpdater.compareAndSet(this, expectedAddr, newAddr);
}
-
+
@Override
@Released
@@ -168,36 +154,41 @@ public class VMStatsLRURegionEntryOffHeapObjectKey extends VMStatsLRURegionEntry
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 int getEntryHash() {
return this.hash;
}
+
protected void setEntryHash(int v) {
this.hash = v;
}
+
/**
* @see HashEntry#getNextEntry()
*/
public HashEntry<Object, Object> getNextEntry() {
return this.next;
}
+
/**
* @see HashEntry#setNextEntry
*/
@@ -205,51 +196,57 @@ public class VMStatsLRURegionEntryOffHeapObjectKey extends VMStatsLRURegionEntry
this.next = n;
}
-
+
// DO NOT modify this class. It was generated from LeafRegionEntry.cpp
-
+
// lru code
@Override
public void setDelayedDiskId(LocalRegion r) {
-
-
- // nothing needed for LRUs with no disk
+ // nothing needed for LRUs with no disk
}
+
public synchronized int updateEntrySize(EnableLRU capacityController) {
- return updateEntrySize(capacityController, _getValue()); // OFHEAP: _getValue ok w/o incing refcount because we are synced and only getting the size
+ return updateEntrySize(capacityController, _getValue()); // OFHEAP: _getValue ok w/o incing
+ // refcount because we are synced and
+ // only getting the size
}
-
+
// DO NOT modify this class. It was generated from LeafRegionEntry.cpp
-
- public synchronized int updateEntrySize(EnableLRU capacityController,
- Object value) {
+
+ public synchronized int updateEntrySize(EnableLRU capacityController, Object value) {
int oldSize = getEntrySize();
- int newSize = capacityController.entrySize( getKeyForSizing(), value);
+ int newSize = capacityController.entrySize(getKeyForSizing(), value);
setEntrySize(newSize);
int delta = newSize - oldSize;
return delta;
}
+
public boolean testRecentlyUsed() {
return areAnyBitsSet(RECENTLY_USED);
}
+
@Override
public void setRecentlyUsed() {
setBits(RECENTLY_USED);
}
+
public void unsetRecentlyUsed() {
clearBits(~RECENTLY_USED);
}
+
public boolean testEvicted() {
return areAnyBitsSet(EVICTED);
}
+
public void setEvicted() {
setBits(EVICTED);
}
+
public void unsetEvicted() {
clearBits(~EVICTED);
}
@@ -259,27 +256,33 @@ public class VMStatsLRURegionEntryOffHeapObjectKey extends VMStatsLRURegionEntry
private LRUClockNode nextLRU;
private LRUClockNode prevLRU;
private int size;
- public void setNextLRUNode( LRUClockNode next ) {
+
+ public void setNextLRUNode(LRUClockNode next) {
this.nextLRU = next;
}
+
public LRUClockNode nextLRUNode() {
return this.nextLRU;
}
- public void setPrevLRUNode( LRUClockNode prev ) {
+
+ public void setPrevLRUNode(LRUClockNode prev) {
this.prevLRU = prev;
}
+
public LRUClockNode prevLRUNode() {
return this.prevLRU;
}
+
public int getEntrySize() {
return this.size;
}
+
protected void setEntrySize(int size) {
this.size = size;
}
// DO NOT modify this class. It was generated from LeafRegionEntry.cpp
-
+
@Override
public Object getKeyForSizing() {
@@ -288,13 +291,12 @@ public class VMStatsLRURegionEntryOffHeapObjectKey extends VMStatsLRURegionEntry
-
}
// DO NOT modify this class. It was generated from LeafRegionEntry.cpp
-
+
// stats code
@Override
public void updateStatsForGet(boolean hit, long time) {
@@ -305,51 +307,60 @@ public class VMStatsLRURegionEntryOffHeapObjectKey extends VMStatsLRURegionEntry
incrementMissCount();
}
}
+
@Override
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<VMStatsLRURegionEntryOffHeapObjectKey> hitCountUpdater
- = AtomicIntegerFieldUpdater.newUpdater(VMStatsLRURegionEntryOffHeapObjectKey.class, "hitCount");
- private static final AtomicIntegerFieldUpdater<VMStatsLRURegionEntryOffHeapObjectKey> missCountUpdater
- = AtomicIntegerFieldUpdater.newUpdater(VMStatsLRURegionEntryOffHeapObjectKey.class, "missCount");
-
+
+ private static final AtomicIntegerFieldUpdater<VMStatsLRURegionEntryOffHeapObjectKey> hitCountUpdater =
+ AtomicIntegerFieldUpdater.newUpdater(VMStatsLRURegionEntryOffHeapObjectKey.class, "hitCount");
+ private static final AtomicIntegerFieldUpdater<VMStatsLRURegionEntryOffHeapObjectKey> missCountUpdater =
+ AtomicIntegerFieldUpdater.newUpdater(VMStatsLRURegionEntryOffHeapObjectKey.class,
+ "missCount");
+
@Override
public long getLastAccessed() throws InternalStatisticsDisabledException {
return this.lastAccessed;
}
+
private void setLastAccessed(long lastAccessed) {
this.lastAccessed = lastAccessed;
}
+
@Override
public long getHitCount() throws InternalStatisticsDisabledException {
return this.hitCount & 0xFFFFFFFFL;
}
+
@Override
public long getMissCount() throws InternalStatisticsDisabledException {
return this.missCount & 0xFFFFFFFFL;
}
+
private void incrementHitCount() {
hitCountUpdater.incrementAndGet(this);
}
+
private void incrementMissCount() {
missCountUpdater.incrementAndGet(this);
}
+
@Override
public 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 void txDidDestroy(long currTime) {
setLastModified(currTime);
@@ -357,19 +368,20 @@ public class VMStatsLRURegionEntryOffHeapObjectKey extends VMStatsLRURegionEntry
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;
+
@Override
public Object getKey() {
return this.key;
http://git-wip-us.apache.org/repos/asf/geode/blob/5adb681a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryOffHeapStringKey1.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryOffHeapStringKey1.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryOffHeapStringKey1.java
index 3d51811..21d16a6 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryOffHeapStringKey1.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryOffHeapStringKey1.java
@@ -18,35 +18,17 @@ package org.apache.geode.internal.cache;
-
-
-
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
import java.util.concurrent.atomic.AtomicLongFieldUpdater;
-
-
-
import org.apache.geode.internal.cache.lru.EnableLRU;
-
-
-
-
import org.apache.geode.internal.InternalStatisticsDisabledException;
-
import org.apache.geode.internal.cache.lru.LRUClockNode;
import org.apache.geode.internal.cache.lru.NewLRUClockHand;
-
-
-
-
-
-
-
import org.apache.geode.internal.offheap.OffHeapRegionEntryHelper;
import org.apache.geode.internal.offheap.annotations.Released;
import org.apache.geode.internal.offheap.annotations.Retained;
@@ -73,7 +55,7 @@ import org.apache.geode.internal.util.concurrent.CustomEntryConcurrentHashMap.Ha
* ./dev-tools/generateRegionEntryClasses.sh (it must be run from the top level directory).
*/
public class VMStatsLRURegionEntryOffHeapStringKey1 extends VMStatsLRURegionEntryOffHeap {
- public VMStatsLRURegionEntryOffHeapStringKey1 (RegionEntryContext context, String key,
+ public VMStatsLRURegionEntryOffHeapStringKey1(RegionEntryContext context, String key,
@Retained
@@ -81,27 +63,28 @@ public class VMStatsLRURegionEntryOffHeapStringKey1 extends VMStatsLRURegionEntr
, boolean byteEncode
- ) {
- super(context,
+ ) {
+ super(context,
- value
+ value
- );
+ );
// DO NOT modify this class. It was generated from LeafRegionEntry.cpp
// caller has already confirmed that key.length <= MAX_INLINE_STRING_KEY
long tmpBits1 = 0L;
if (byteEncode) {
- 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;
}
@@ -112,35 +95,39 @@ public class VMStatsLRURegionEntryOffHeapStringKey1 extends VMStatsLRURegionEntr
}
// 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<VMStatsLRURegionEntryOffHeapStringKey1> lastModifiedUpdater
- = AtomicLongFieldUpdater.newUpdater(VMStatsLRURegionEntryOffHeapStringKey1.class, "lastModified");
+ private static final AtomicLongFieldUpdater<VMStatsLRURegionEntryOffHeapStringKey1> lastModifiedUpdater =
+ AtomicLongFieldUpdater.newUpdater(VMStatsLRURegionEntryOffHeapStringKey1.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<VMStatsLRURegionEntryOffHeapStringKey1> ohAddrUpdater = AtomicLongFieldUpdater.newUpdater(VMStatsLRURegionEntryOffHeapStringKey1.class, "ohAddress");
-
+ private final static AtomicLongFieldUpdater<VMStatsLRURegionEntryOffHeapStringKey1> ohAddrUpdater =
+ AtomicLongFieldUpdater.newUpdater(VMStatsLRURegionEntryOffHeapStringKey1.class, "ohAddress");
+
@Override
public Token getValueAsToken() {
return OffHeapRegionEntryHelper.getValueAsToken(this);
}
-
+
@Override
protected Object getValueField() {
return OffHeapRegionEntryHelper._getValue(this);
@@ -156,6 +143,7 @@ public class VMStatsLRURegionEntryOffHeapStringKey1 extends VMStatsLRURegionEntr
OffHeapRegionEntryHelper.setValue(this, v);
}
+
@Override
@Retained
@@ -173,7 +161,7 @@ public class VMStatsLRURegionEntryOffHeapStringKey1 extends VMStatsLRURegionEntr
public boolean setAddress(long expectedAddr, long newAddr) {
return ohAddrUpdater.compareAndSet(this, expectedAddr, newAddr);
}
-
+
@Override
@Released
@@ -181,36 +169,41 @@ public class VMStatsLRURegionEntryOffHeapStringKey1 extends VMStatsLRURegionEntr
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 int getEntryHash() {
return this.hash;
}
+
protected void setEntryHash(int v) {
this.hash = v;
}
+
/**
* @see HashEntry#getNextEntry()
*/
public HashEntry<Object, Object> getNextEntry() {
return this.next;
}
+
/**
* @see HashEntry#setNextEntry
*/
@@ -218,51 +211,57 @@ public class VMStatsLRURegionEntryOffHeapStringKey1 extends VMStatsLRURegionEntr
this.next = n;
}
-
+
// DO NOT modify this class. It was generated from LeafRegionEntry.cpp
-
+
// lru code
@Override
public void setDelayedDiskId(LocalRegion r) {
-
-
- // nothing needed for LRUs with no disk
+ // nothing needed for LRUs with no disk
}
+
public synchronized int updateEntrySize(EnableLRU capacityController) {
- return updateEntrySize(capacityController, _getValue()); // OFHEAP: _getValue ok w/o incing refcount because we are synced and only getting the size
+ return updateEntrySize(capacityController, _getValue()); // OFHEAP: _getValue ok w/o incing
+ // refcount because we are synced and
+ // only getting the size
}
-
+
// DO NOT modify this class. It was generated from LeafRegionEntry.cpp
-
- public synchronized int updateEntrySize(EnableLRU capacityController,
- Object value) {
+
+ public synchronized int updateEntrySize(EnableLRU capacityController, Object value) {
int oldSize = getEntrySize();
- int newSize = capacityController.entrySize( getKeyForSizing(), value);
+ int newSize = capacityController.entrySize(getKeyForSizing(), value);
setEntrySize(newSize);
int delta = newSize - oldSize;
return delta;
}
+
public boolean testRecentlyUsed() {
return areAnyBitsSet(RECENTLY_USED);
}
+
@Override
public void setRecentlyUsed() {
setBits(RECENTLY_USED);
}
+
public void unsetRecentlyUsed() {
clearBits(~RECENTLY_USED);
}
+
public boolean testEvicted() {
return areAnyBitsSet(EVICTED);
}
+
public void setEvicted() {
setBits(EVICTED);
}
+
public void unsetEvicted() {
clearBits(~EVICTED);
}
@@ -272,33 +271,38 @@ public class VMStatsLRURegionEntryOffHeapStringKey1 extends VMStatsLRURegionEntr
private LRUClockNode nextLRU;
private LRUClockNode prevLRU;
private int size;
- public void setNextLRUNode( LRUClockNode next ) {
+
+ public void setNextLRUNode(LRUClockNode next) {
this.nextLRU = next;
}
+
public LRUClockNode nextLRUNode() {
return this.nextLRU;
}
- public void setPrevLRUNode( LRUClockNode prev ) {
+
+ public void setPrevLRUNode(LRUClockNode prev) {
this.prevLRU = prev;
}
+
public LRUClockNode prevLRUNode() {
return this.prevLRU;
}
+
public int getEntrySize() {
return this.size;
}
+
protected void setEntrySize(int size) {
this.size = size;
}
// DO NOT modify this class. It was generated from LeafRegionEntry.cpp
-
+
@Override
public Object getKeyForSizing() {
-
// inline keys always report null for sizing since the size comes from the entry size
return null;
@@ -307,7 +311,7 @@ public class VMStatsLRURegionEntryOffHeapStringKey1 extends VMStatsLRURegionEntr
// DO NOT modify this class. It was generated from LeafRegionEntry.cpp
-
+
// stats code
@Override
public void updateStatsForGet(boolean hit, long time) {
@@ -318,51 +322,61 @@ public class VMStatsLRURegionEntryOffHeapStringKey1 extends VMStatsLRURegionEntr
incrementMissCount();
}
}
+
@Override
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<VMStatsLRURegionEntryOffHeapStringKey1> hitCountUpdater
- = AtomicIntegerFieldUpdater.newUpdater(VMStatsLRURegionEntryOffHeapStringKey1.class, "hitCount");
- private static final AtomicIntegerFieldUpdater<VMStatsLRURegionEntryOffHeapStringKey1> missCountUpdater
- = AtomicIntegerFieldUpdater.newUpdater(VMStatsLRURegionEntryOffHeapStringKey1.class, "missCount");
-
+
+ private static final AtomicIntegerFieldUpdater<VMStatsLRURegionEntryOffHeapStringKey1> hitCountUpdater =
+ AtomicIntegerFieldUpdater.newUpdater(VMStatsLRURegionEntryOffHeapStringKey1.class,
+ "hitCount");
+ private static final AtomicIntegerFieldUpdater<VMStatsLRURegionEntryOffHeapStringKey1> missCountUpdater =
+ AtomicIntegerFieldUpdater.newUpdater(VMStatsLRURegionEntryOffHeapStringKey1.class,
+ "missCount");
+
@Override
public long getLastAccessed() throws InternalStatisticsDisabledException {
return this.lastAccessed;
}
+
private void setLastAccessed(long lastAccessed) {
this.lastAccessed = lastAccessed;
}
+
@Override
public long getHitCount() throws InternalStatisticsDisabledException {
return this.hitCount & 0xFFFFFFFFL;
}
+
@Override
public long getMissCount() throws InternalStatisticsDisabledException {
return this.missCount & 0xFFFFFFFFL;
}
+
private void incrementHitCount() {
hitCountUpdater.incrementAndGet(this);
}
+
private void incrementMissCount() {
missCountUpdater.incrementAndGet(this);
}
+
@Override
public 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 void txDidDestroy(long currTime) {
setLastModified(currTime);
@@ -370,39 +384,42 @@ public class VMStatsLRURegionEntryOffHeapStringKey1 extends VMStatsLRURegionEntr
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 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 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);
}
@@ -411,16 +428,16 @@ public class VMStatsLRURegionEntryOffHeapStringKey1 extends VMStatsLRURegionEntr
}
// 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) {
@@ -428,7 +445,7 @@ public class VMStatsLRURegionEntryOffHeapStringKey1 extends VMStatsLRURegionEntr
}
}
} 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) {
@@ -441,7 +458,7 @@ public class VMStatsLRURegionEntryOffHeapStringKey1 extends VMStatsLRURegionEntr
}
return false;
}
-
+
// DO NOT modify this class. It was generated from LeafRegionEntry.cpp
}
http://git-wip-us.apache.org/repos/asf/geode/blob/5adb681a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryOffHeapStringKey2.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryOffHeapStringKey2.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryOffHeapStringKey2.java
index 6335b9d..54818ae 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryOffHeapStringKey2.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryOffHeapStringKey2.java
@@ -18,35 +18,17 @@ package org.apache.geode.internal.cache;
-
-
-
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
import java.util.concurrent.atomic.AtomicLongFieldUpdater;
-
-
-
import org.apache.geode.internal.cache.lru.EnableLRU;
-
-
-
-
import org.apache.geode.internal.InternalStatisticsDisabledException;
-
import org.apache.geode.internal.cache.lru.LRUClockNode;
import org.apache.geode.internal.cache.lru.NewLRUClockHand;
-
-
-
-
-
-
-
import org.apache.geode.internal.offheap.OffHeapRegionEntryHelper;
import org.apache.geode.internal.offheap.annotations.Released;
import org.apache.geode.internal.offheap.annotations.Retained;
@@ -73,7 +55,7 @@ import org.apache.geode.internal.util.concurrent.CustomEntryConcurrentHashMap.Ha
* ./dev-tools/generateRegionEntryClasses.sh (it must be run from the top level directory).
*/
public class VMStatsLRURegionEntryOffHeapStringKey2 extends VMStatsLRURegionEntryOffHeap {
- public VMStatsLRURegionEntryOffHeapStringKey2 (RegionEntryContext context, String key,
+ public VMStatsLRURegionEntryOffHeapStringKey2(RegionEntryContext context, String key,
@Retained
@@ -81,33 +63,34 @@ public class VMStatsLRURegionEntryOffHeapStringKey2 extends VMStatsLRURegionEntr
, boolean byteEncode
- ) {
- super(context,
+ ) {
+ super(context,
- value
+ value
- );
+ );
// DO NOT modify this class. It was generated from LeafRegionEntry.cpp
// caller has already confirmed that key.length <= MAX_INLINE_STRING_KEY
long tmpBits1 = 0L;
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;
@@ -124,35 +107,39 @@ public class VMStatsLRURegionEntryOffHeapStringKey2 extends VMStatsLRURegionEntr
}
// 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<VMStatsLRURegionEntryOffHeapStringKey2> lastModifiedUpdater
- = AtomicLongFieldUpdater.newUpdater(VMStatsLRURegionEntryOffHeapStringKey2.class, "lastModified");
+ private static final AtomicLongFieldUpdater<VMStatsLRURegionEntryOffHeapStringKey2> lastModifiedUpdater =
+ AtomicLongFieldUpdater.newUpdater(VMStatsLRURegionEntryOffHeapStringKey2.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<VMStatsLRURegionEntryOffHeapStringKey2> ohAddrUpdater = AtomicLongFieldUpdater.newUpdater(VMStatsLRURegionEntryOffHeapStringKey2.class, "ohAddress");
-
+ private final static AtomicLongFieldUpdater<VMStatsLRURegionEntryOffHeapStringKey2> ohAddrUpdater =
+ AtomicLongFieldUpdater.newUpdater(VMStatsLRURegionEntryOffHeapStringKey2.class, "ohAddress");
+
@Override
public Token getValueAsToken() {
return OffHeapRegionEntryHelper.getValueAsToken(this);
}
-
+
@Override
protected Object getValueField() {
return OffHeapRegionEntryHelper._getValue(this);
@@ -168,6 +155,7 @@ public class VMStatsLRURegionEntryOffHeapStringKey2 extends VMStatsLRURegionEntr
OffHeapRegionEntryHelper.setValue(this, v);
}
+
@Override
@Retained
@@ -185,7 +173,7 @@ public class VMStatsLRURegionEntryOffHeapStringKey2 extends VMStatsLRURegionEntr
public boolean setAddress(long expectedAddr, long newAddr) {
return ohAddrUpdater.compareAndSet(this, expectedAddr, newAddr);
}
-
+
@Override
@Released
@@ -193,36 +181,41 @@ public class VMStatsLRURegionEntryOffHeapStringKey2 extends VMStatsLRURegionEntr
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 int getEntryHash() {
return this.hash;
}
+
protected void setEntryHash(int v) {
this.hash = v;
}
+
/**
* @see HashEntry#getNextEntry()
*/
public HashEntry<Object, Object> getNextEntry() {
return this.next;
}
+
/**
* @see HashEntry#setNextEntry
*/
@@ -230,51 +223,57 @@ public class VMStatsLRURegionEntryOffHeapStringKey2 extends VMStatsLRURegionEntr
this.next = n;
}
-
+
// DO NOT modify this class. It was generated from LeafRegionEntry.cpp
-
+
// lru code
@Override
public void setDelayedDiskId(LocalRegion r) {
-
-
- // nothing needed for LRUs with no disk
+ // nothing needed for LRUs with no disk
}
+
public synchronized int updateEntrySize(EnableLRU capacityController) {
- return updateEntrySize(capacityController, _getValue()); // OFHEAP: _getValue ok w/o incing refcount because we are synced and only getting the size
+ return updateEntrySize(capacityController, _getValue()); // OFHEAP: _getValue ok w/o incing
+ // refcount because we are synced and
+ // only getting the size
}
-
+
// DO NOT modify this class. It was generated from LeafRegionEntry.cpp
-
- public synchronized int updateEntrySize(EnableLRU capacityController,
- Object value) {
+
+ public synchronized int updateEntrySize(EnableLRU capacityController, Object value) {
int oldSize = getEntrySize();
- int newSize = capacityController.entrySize( getKeyForSizing(), value);
+ int newSize = capacityController.entrySize(getKeyForSizing(), value);
setEntrySize(newSize);
int delta = newSize - oldSize;
return delta;
}
+
public boolean testRecentlyUsed() {
return areAnyBitsSet(RECENTLY_USED);
}
+
@Override
public void setRecentlyUsed() {
setBits(RECENTLY_USED);
}
+
public void unsetRecentlyUsed() {
clearBits(~RECENTLY_USED);
}
+
public boolean testEvicted() {
return areAnyBitsSet(EVICTED);
}
+
public void setEvicted() {
setBits(EVICTED);
}
+
public void unsetEvicted() {
clearBits(~EVICTED);
}
@@ -284,33 +283,38 @@ public class VMStatsLRURegionEntryOffHeapStringKey2 extends VMStatsLRURegionEntr
private LRUClockNode nextLRU;
private LRUClockNode prevLRU;
private int size;
- public void setNextLRUNode( LRUClockNode next ) {
+
+ public void setNextLRUNode(LRUClockNode next) {
this.nextLRU = next;
}
+
public LRUClockNode nextLRUNode() {
return this.nextLRU;
}
- public void setPrevLRUNode( LRUClockNode prev ) {
+
+ public void setPrevLRUNode(LRUClockNode prev) {
this.prevLRU = prev;
}
+
public LRUClockNode prevLRUNode() {
return this.prevLRU;
}
+
public int getEntrySize() {
return this.size;
}
+
protected void setEntrySize(int size) {
this.size = size;
}
// DO NOT modify this class. It was generated from LeafRegionEntry.cpp
-
+
@Override
public Object getKeyForSizing() {
-
// inline keys always report null for sizing since the size comes from the entry size
return null;
@@ -319,7 +323,7 @@ public class VMStatsLRURegionEntryOffHeapStringKey2 extends VMStatsLRURegionEntr
// DO NOT modify this class. It was generated from LeafRegionEntry.cpp
-
+
// stats code
@Override
public void updateStatsForGet(boolean hit, long time) {
@@ -330,51 +334,61 @@ public class VMStatsLRURegionEntryOffHeapStringKey2 extends VMStatsLRURegionEntr
incrementMissCount();
}
}
+
@Override
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<VMStatsLRURegionEntryOffHeapStringKey2> hitCountUpdater
- = AtomicIntegerFieldUpdater.newUpdater(VMStatsLRURegionEntryOffHeapStringKey2.class, "hitCount");
- private static final AtomicIntegerFieldUpdater<VMStatsLRURegionEntryOffHeapStringKey2> missCountUpdater
- = AtomicIntegerFieldUpdater.newUpdater(VMStatsLRURegionEntryOffHeapStringKey2.class, "missCount");
-
+
+ private static final AtomicIntegerFieldUpdater<VMStatsLRURegionEntryOffHeapStringKey2> hitCountUpdater =
+ AtomicIntegerFieldUpdater.newUpdater(VMStatsLRURegionEntryOffHeapStringKey2.class,
+ "hitCount");
+ private static final AtomicIntegerFieldUpdater<VMStatsLRURegionEntryOffHeapStringKey2> missCountUpdater =
+ AtomicIntegerFieldUpdater.newUpdater(VMStatsLRURegionEntryOffHeapStringKey2.class,
+ "missCount");
+
@Override
public long getLastAccessed() throws InternalStatisticsDisabledException {
return this.lastAccessed;
}
+
private void setLastAccessed(long lastAccessed) {
this.lastAccessed = lastAccessed;
}
+
@Override
public long getHitCount() throws InternalStatisticsDisabledException {
return this.hitCount & 0xFFFFFFFFL;
}
+
@Override
public long getMissCount() throws InternalStatisticsDisabledException {
return this.missCount & 0xFFFFFFFFL;
}
+
private void incrementHitCount() {
hitCountUpdater.incrementAndGet(this);
}
+
private void incrementMissCount() {
missCountUpdater.incrementAndGet(this);
}
+
@Override
public 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 void txDidDestroy(long currTime) {
setLastModified(currTime);
@@ -382,16 +396,16 @@ public class VMStatsLRURegionEntryOffHeapStringKey2 extends VMStatsLRURegionEntr
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)
@@ -400,14 +414,17 @@ public class VMStatsLRURegionEntryOffHeapStringKey2 extends VMStatsLRURegionEntr
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 Object getKey() {
int keylen = getKeyLength();
@@ -415,7 +432,7 @@ public class VMStatsLRURegionEntryOffHeapStringKey2 extends VMStatsLRURegionEntr
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);
@@ -425,10 +442,10 @@ public class VMStatsLRURegionEntryOffHeapStringKey2 extends VMStatsLRURegionEntr
}
}
} 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;
@@ -439,17 +456,17 @@ public class VMStatsLRURegionEntryOffHeapStringKey2 extends VMStatsLRURegionEntr
}
// 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;
@@ -463,7 +480,7 @@ public class VMStatsLRURegionEntryOffHeapStringKey2 extends VMStatsLRURegionEntr
}
}
} else {
- for (int i=0; i < keylen; i++) {
+ for (int i = 0; i < keylen; i++) {
char c;
if (i < 3) {
tmpBits1 >>= 16;
http://git-wip-us.apache.org/repos/asf/geode/blob/5adb681a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryOffHeapUUIDKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryOffHeapUUIDKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryOffHeapUUIDKey.java
index d43aea1..1a50d0f 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryOffHeapUUIDKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VMStatsLRURegionEntryOffHeapUUIDKey.java
@@ -20,33 +20,17 @@ package org.apache.geode.internal.cache;
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.InternalStatisticsDisabledException;
-
import org.apache.geode.internal.cache.lru.LRUClockNode;
import org.apache.geode.internal.cache.lru.NewLRUClockHand;
-
-
-
-
-
-
-
import org.apache.geode.internal.offheap.OffHeapRegionEntryHelper;
import org.apache.geode.internal.offheap.annotations.Released;
import org.apache.geode.internal.offheap.annotations.Retained;
@@ -73,7 +57,7 @@ import org.apache.geode.internal.util.concurrent.CustomEntryConcurrentHashMap.Ha
* ./dev-tools/generateRegionEntryClasses.sh (it must be run from the top level directory).
*/
public class VMStatsLRURegionEntryOffHeapUUIDKey extends VMStatsLRURegionEntryOffHeap {
- public VMStatsLRURegionEntryOffHeapUUIDKey (RegionEntryContext context, UUID key,
+ public VMStatsLRURegionEntryOffHeapUUIDKey(RegionEntryContext context, UUID key,
@Retained
@@ -81,14 +65,14 @@ public class VMStatsLRURegionEntryOffHeapUUIDKey extends VMStatsLRURegionEntryOf
- ) {
- super(context,
+ ) {
+ super(context,
- value
+ value
- );
+ );
// DO NOT modify this class. It was generated from LeafRegionEntry.cpp
this.keyMostSigBits = key.getMostSignificantBits();
@@ -97,35 +81,38 @@ public class VMStatsLRURegionEntryOffHeapUUIDKey extends VMStatsLRURegionEntryOf
}
// 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<VMStatsLRURegionEntryOffHeapUUIDKey> lastModifiedUpdater
- = AtomicLongFieldUpdater.newUpdater(VMStatsLRURegionEntryOffHeapUUIDKey.class, "lastModified");
+ private static final AtomicLongFieldUpdater<VMStatsLRURegionEntryOffHeapUUIDKey> lastModifiedUpdater =
+ AtomicLongFieldUpdater.newUpdater(VMStatsLRURegionEntryOffHeapUUIDKey.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<VMStatsLRURegionEntryOffHeapUUIDKey> ohAddrUpdater = AtomicLongFieldUpdater.newUpdater(VMStatsLRURegionEntryOffHeapUUIDKey.class, "ohAddress");
-
+ private final static AtomicLongFieldUpdater<VMStatsLRURegionEntryOffHeapUUIDKey> ohAddrUpdater =
+ AtomicLongFieldUpdater.newUpdater(VMStatsLRURegionEntryOffHeapUUIDKey.class, "ohAddress");
+
@Override
public Token getValueAsToken() {
return OffHeapRegionEntryHelper.getValueAsToken(this);
}
-
+
@Override
protected Object getValueField() {
return OffHeapRegionEntryHelper._getValue(this);
@@ -141,6 +128,7 @@ public class VMStatsLRURegionEntryOffHeapUUIDKey extends VMStatsLRURegionEntryOf
OffHeapRegionEntryHelper.setValue(this, v);
}
+
@Override
@Retained
@@ -158,7 +146,7 @@ public class VMStatsLRURegionEntryOffHeapUUIDKey extends VMStatsLRURegionEntryOf
public boolean setAddress(long expectedAddr, long newAddr) {
return ohAddrUpdater.compareAndSet(this, expectedAddr, newAddr);
}
-
+
@Override
@Released
@@ -166,36 +154,41 @@ public class VMStatsLRURegionEntryOffHeapUUIDKey extends VMStatsLRURegionEntryOf
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 int getEntryHash() {
return this.hash;
}
+
protected void setEntryHash(int v) {
this.hash = v;
}
+
/**
* @see HashEntry#getNextEntry()
*/
public HashEntry<Object, Object> getNextEntry() {
return this.next;
}
+
/**
* @see HashEntry#setNextEntry
*/
@@ -203,51 +196,57 @@ public class VMStatsLRURegionEntryOffHeapUUIDKey extends VMStatsLRURegionEntryOf
this.next = n;
}
-
+
// DO NOT modify this class. It was generated from LeafRegionEntry.cpp
-
+
// lru code
@Override
public void setDelayedDiskId(LocalRegion r) {
-
-
- // nothing needed for LRUs with no disk
+ // nothing needed for LRUs with no disk
}
+
public synchronized int updateEntrySize(EnableLRU capacityController) {
- return updateEntrySize(capacityController, _getValue()); // OFHEAP: _getValue ok w/o incing refcount because we are synced and only getting the size
+ return updateEntrySize(capacityController, _getValue()); // OFHEAP: _getValue ok w/o incing
+ // refcount because we are synced and
+ // only getting the size
}
-
+
// DO NOT modify this class. It was generated from LeafRegionEntry.cpp
-
- public synchronized int updateEntrySize(EnableLRU capacityController,
- Object value) {
+
+ public synchronized int updateEntrySize(EnableLRU capacityController, Object value) {
int oldSize = getEntrySize();
- int newSize = capacityController.entrySize( getKeyForSizing(), value);
+ int newSize = capacityController.entrySize(getKeyForSizing(), value);
setEntrySize(newSize);
int delta = newSize - oldSize;
return delta;
}
+
public boolean testRecentlyUsed() {
return areAnyBitsSet(RECENTLY_USED);
}
+
@Override
public void setRecentlyUsed() {
setBits(RECENTLY_USED);
}
+
public void unsetRecentlyUsed() {
clearBits(~RECENTLY_USED);
}
+
public boolean testEvicted() {
return areAnyBitsSet(EVICTED);
}
+
public void setEvicted() {
setBits(EVICTED);
}
+
public void unsetEvicted() {
clearBits(~EVICTED);
}
@@ -257,33 +256,38 @@ public class VMStatsLRURegionEntryOffHeapUUIDKey extends VMStatsLRURegionEntryOf
private LRUClockNode nextLRU;
private LRUClockNode prevLRU;
private int size;
- public void setNextLRUNode( LRUClockNode next ) {
+
+ public void setNextLRUNode(LRUClockNode next) {
this.nextLRU = next;
}
+
public LRUClockNode nextLRUNode() {
return this.nextLRU;
}
- public void setPrevLRUNode( LRUClockNode prev ) {
+
+ public void setPrevLRUNode(LRUClockNode prev) {
this.prevLRU = prev;
}
+
public LRUClockNode prevLRUNode() {
return this.prevLRU;
}
+
public int getEntrySize() {
return this.size;
}
+
protected void setEntrySize(int size) {
this.size = size;
}
// DO NOT modify this class. It was generated from LeafRegionEntry.cpp
-
+
@Override
public Object getKeyForSizing() {
-
// inline keys always report null for sizing since the size comes from the entry size
return null;
@@ -292,7 +296,7 @@ public class VMStatsLRURegionEntryOffHeapUUIDKey extends VMStatsLRURegionEntryOf
// DO NOT modify this class. It was generated from LeafRegionEntry.cpp
-
+
// stats code
@Override
public void updateStatsForGet(boolean hit, long time) {
@@ -303,51 +307,59 @@ public class VMStatsLRURegionEntryOffHeapUUIDKey extends VMStatsLRURegionEntryOf
incrementMissCount();
}
}
+
@Override
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<VMStatsLRURegionEntryOffHeapUUIDKey> hitCountUpdater
- = AtomicIntegerFieldUpdater.newUpdater(VMStatsLRURegionEntryOffHeapUUIDKey.class, "hitCount");
- private static final AtomicIntegerFieldUpdater<VMStatsLRURegionEntryOffHeapUUIDKey> missCountUpdater
- = AtomicIntegerFieldUpdater.newUpdater(VMStatsLRURegionEntryOffHeapUUIDKey.class, "missCount");
-
+
+ private static final AtomicIntegerFieldUpdater<VMStatsLRURegionEntryOffHeapUUIDKey> hitCountUpdater =
+ AtomicIntegerFieldUpdater.newUpdater(VMStatsLRURegionEntryOffHeapUUIDKey.class, "hitCount");
+ private static final AtomicIntegerFieldUpdater<VMStatsLRURegionEntryOffHeapUUIDKey> missCountUpdater =
+ AtomicIntegerFieldUpdater.newUpdater(VMStatsLRURegionEntryOffHeapUUIDKey.class, "missCount");
+
@Override
public long getLastAccessed() throws InternalStatisticsDisabledException {
return this.lastAccessed;
}
+
private void setLastAccessed(long lastAccessed) {
this.lastAccessed = lastAccessed;
}
+
@Override
public long getHitCount() throws InternalStatisticsDisabledException {
return this.hitCount & 0xFFFFFFFFL;
}
+
@Override
public long getMissCount() throws InternalStatisticsDisabledException {
return this.missCount & 0xFFFFFFFFL;
}
+
private void incrementHitCount() {
hitCountUpdater.incrementAndGet(this);
}
+
private void incrementMissCount() {
missCountUpdater.incrementAndGet(this);
}
+
@Override
public 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 void txDidDestroy(long currTime) {
setLastModified(currTime);
@@ -355,24 +367,26 @@ public class VMStatsLRURegionEntryOffHeapUUIDKey extends VMStatsLRURegionEntryOf
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 Object getKey() {
return new UUID(this.keyMostSigBits, this.keyLeastSigBits);
}
+
@Override
public boolean isKeyEqual(Object k) {
if (k instanceof UUID) {
@@ -382,7 +396,7 @@ public class VMStatsLRURegionEntryOffHeapUUIDKey extends VMStatsLRURegionEntryOf
}
return false;
}
-
+
// DO NOT modify this class. It was generated from LeafRegionEntry.cpp
}