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:06 UTC
[56/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/VersionedStatsLRURegionEntryOffHeapIntKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryOffHeapIntKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryOffHeapIntKey.java
index 241f6da..53cb9ab 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryOffHeapIntKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryOffHeapIntKey.java
@@ -18,35 +18,24 @@ package org.apache.geode.internal.cache;
-
-
-
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
import java.util.concurrent.atomic.AtomicLongFieldUpdater;
import org.apache.geode.cache.EntryEvent;
-
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.distributed.internal.membership.InternalDistributedMember;
import org.apache.geode.internal.cache.versions.VersionSource;
import org.apache.geode.internal.cache.versions.VersionStamp;
import org.apache.geode.internal.cache.versions.VersionTag;
-
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 +62,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 VersionedStatsLRURegionEntryOffHeapIntKey extends VersionedStatsLRURegionEntryOffHeap {
- public VersionedStatsLRURegionEntryOffHeapIntKey (RegionEntryContext context, int key,
+ public VersionedStatsLRURegionEntryOffHeapIntKey(RegionEntryContext context, int key,
@Retained
@@ -81,55 +70,57 @@ public class VersionedStatsLRURegionEntryOffHeapIntKey extends VersionedStatsLRU
- ) {
- 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<VersionedStatsLRURegionEntryOffHeapIntKey> lastModifiedUpdater
- = AtomicLongFieldUpdater.newUpdater(VersionedStatsLRURegionEntryOffHeapIntKey.class, "lastModified");
+ private static final AtomicLongFieldUpdater<VersionedStatsLRURegionEntryOffHeapIntKey> lastModifiedUpdater =
+ AtomicLongFieldUpdater.newUpdater(VersionedStatsLRURegionEntryOffHeapIntKey.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<VersionedStatsLRURegionEntryOffHeapIntKey> ohAddrUpdater = AtomicLongFieldUpdater.newUpdater(VersionedStatsLRURegionEntryOffHeapIntKey.class, "ohAddress");
-
+ private final static AtomicLongFieldUpdater<VersionedStatsLRURegionEntryOffHeapIntKey> ohAddrUpdater =
+ AtomicLongFieldUpdater.newUpdater(VersionedStatsLRURegionEntryOffHeapIntKey.class,
+ "ohAddress");
+
@Override
public Token getValueAsToken() {
return OffHeapRegionEntryHelper.getValueAsToken(this);
}
-
+
@Override
protected Object getValueField() {
return OffHeapRegionEntryHelper._getValue(this);
@@ -145,6 +136,7 @@ public class VersionedStatsLRURegionEntryOffHeapIntKey extends VersionedStatsLRU
OffHeapRegionEntryHelper.setValue(this, v);
}
+
@Override
@Retained
@@ -162,7 +154,7 @@ public class VersionedStatsLRURegionEntryOffHeapIntKey extends VersionedStatsLRU
public boolean setAddress(long expectedAddr, long newAddr) {
return ohAddrUpdater.compareAndSet(this, expectedAddr, newAddr);
}
-
+
@Override
@Released
@@ -170,36 +162,41 @@ public class VersionedStatsLRURegionEntryOffHeapIntKey extends VersionedStatsLRU
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 +204,57 @@ public class VersionedStatsLRURegionEntryOffHeapIntKey extends VersionedStatsLRU
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 +264,38 @@ public class VersionedStatsLRURegionEntryOffHeapIntKey extends VersionedStatsLRU
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 +304,7 @@ public class VersionedStatsLRURegionEntryOffHeapIntKey extends VersionedStatsLRU
// DO NOT modify this class. It was generated from LeafRegionEntry.cpp
-
+
// stats code
@Override
public void updateStatsForGet(boolean hit, long time) {
@@ -307,51 +315,61 @@ public class VersionedStatsLRURegionEntryOffHeapIntKey extends VersionedStatsLRU
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<VersionedStatsLRURegionEntryOffHeapIntKey> hitCountUpdater
- = AtomicIntegerFieldUpdater.newUpdater(VersionedStatsLRURegionEntryOffHeapIntKey.class, "hitCount");
- private static final AtomicIntegerFieldUpdater<VersionedStatsLRURegionEntryOffHeapIntKey> missCountUpdater
- = AtomicIntegerFieldUpdater.newUpdater(VersionedStatsLRURegionEntryOffHeapIntKey.class, "missCount");
-
+
+ private static final AtomicIntegerFieldUpdater<VersionedStatsLRURegionEntryOffHeapIntKey> hitCountUpdater =
+ AtomicIntegerFieldUpdater.newUpdater(VersionedStatsLRURegionEntryOffHeapIntKey.class,
+ "hitCount");
+ private static final AtomicIntegerFieldUpdater<VersionedStatsLRURegionEntryOffHeapIntKey> missCountUpdater =
+ AtomicIntegerFieldUpdater.newUpdater(VersionedStatsLRURegionEntryOffHeapIntKey.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,15 +377,16 @@ public class VersionedStatsLRURegionEntryOffHeapIntKey extends VersionedStatsLRU
this.hitCount = 0;
this.missCount = 0;
}
+
@Override
public boolean hasStats() {
return true;
}
-
+
// DO NOT modify this class. It was generated from LeafRegionEntry.cpp
-
+
// versioned code
private VersionSource memberID;
private short entryVersionLowBytes;
@@ -379,16 +398,16 @@ public class VersionedStatsLRURegionEntryOffHeapIntKey extends VersionedStatsLRU
public int getEntryVersion() {
return ((entryVersionHighByte << 16) & 0xFF0000) | (entryVersionLowBytes & 0xFFFF);
}
-
+
public long getRegionVersion() {
- return (((long)regionVersionHighBytes) << 32) | (regionVersionLowBytes & 0x00000000FFFFFFFFL);
+ return (((long) regionVersionHighBytes) << 32) | (regionVersionLowBytes & 0x00000000FFFFFFFFL);
}
-
-
+
+
public long getVersionTimeStamp() {
return getLastModified();
}
-
+
public void setVersionTimeStamp(long time) {
setLastModified(time);
}
@@ -396,17 +415,18 @@ public class VersionedStatsLRURegionEntryOffHeapIntKey extends VersionedStatsLRU
public VersionSource getMemberID() {
return this.memberID;
}
+
public int getDistributedSystemId() {
return this.distributedSystemId;
}
// DO NOT modify this class. It was generated from LeafRegionEntry.cpp
-
+
public void setVersions(VersionTag tag) {
this.memberID = tag.getMemberID();
int eVersion = tag.getEntryVersion();
- this.entryVersionLowBytes = (short)(eVersion & 0xffff);
- this.entryVersionHighByte = (byte)((eVersion & 0xff0000) >> 16);
+ this.entryVersionLowBytes = (short) (eVersion & 0xffff);
+ this.entryVersionHighByte = (byte) ((eVersion & 0xff0000) >> 16);
this.regionVersionHighBytes = tag.getRegionVersionHighBytes();
this.regionVersionLowBytes = tag.getRegionVersionLowBytes();
if (!(tag.isGatewayTag()) && this.distributedSystemId == tag.getDistributedSystemId()) {
@@ -418,11 +438,11 @@ public class VersionedStatsLRURegionEntryOffHeapIntKey extends VersionedStatsLRU
} else {
setVersionTimeStamp(tag.getVersionTimeStamp());
}
- this.distributedSystemId = (byte)(tag.getDistributedSystemId() & 0xff);
+ this.distributedSystemId = (byte) (tag.getDistributedSystemId() & 0xff);
}
public void setMemberID(VersionSource memberID) {
- this.memberID = memberID;
+ this.memberID = memberID;
}
@Override
@@ -431,7 +451,7 @@ public class VersionedStatsLRURegionEntryOffHeapIntKey extends VersionedStatsLRU
}
// DO NOT modify this class. It was generated from LeafRegionEntry.cpp
-
+
public VersionTag asVersionTag() {
VersionTag tag = VersionTag.create(memberID);
tag.setEntryVersion(getEntryVersion());
@@ -441,9 +461,9 @@ public class VersionedStatsLRURegionEntryOffHeapIntKey extends VersionedStatsLRU
return tag;
}
- public void processVersionTag(LocalRegion r, VersionTag tag,
- boolean isTombstoneFromGII, boolean hasDelta,
- VersionSource thisVM, InternalDistributedMember sender, boolean checkForConflicts) {
+ public void processVersionTag(LocalRegion r, VersionTag tag, boolean isTombstoneFromGII,
+ boolean hasDelta, VersionSource thisVM, InternalDistributedMember sender,
+ boolean checkForConflicts) {
basicProcessVersionTag(r, tag, isTombstoneFromGII, hasDelta, thisVM, sender, checkForConflicts);
}
@@ -458,29 +478,26 @@ public class VersionedStatsLRURegionEntryOffHeapIntKey extends VersionedStatsLRU
public short getRegionVersionHighBytes() {
return this.regionVersionHighBytes;
}
-
+
/** get rvv internal low bytes. Used by region entries for transferring to storage */
public int getRegionVersionLowBytes() {
return this.regionVersionLowBytes;
}
-
- // 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) {
@@ -488,7 +505,7 @@ public class VersionedStatsLRURegionEntryOffHeapIntKey extends VersionedStatsLRU
}
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/VersionedStatsLRURegionEntryOffHeapLongKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryOffHeapLongKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryOffHeapLongKey.java
index 2e62cd6..de68700 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryOffHeapLongKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryOffHeapLongKey.java
@@ -18,35 +18,24 @@ package org.apache.geode.internal.cache;
-
-
-
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
import java.util.concurrent.atomic.AtomicLongFieldUpdater;
import org.apache.geode.cache.EntryEvent;
-
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.distributed.internal.membership.InternalDistributedMember;
import org.apache.geode.internal.cache.versions.VersionSource;
import org.apache.geode.internal.cache.versions.VersionStamp;
import org.apache.geode.internal.cache.versions.VersionTag;
-
import org.apache.geode.internal.offheap.OffHeapRegionEntryHelper;
import org.apache.geode.internal.offheap.annotations.Released;
import org.apache.geode.internal.offheap.annotations.Retained;
@@ -72,8 +61,9 @@ import org.apache.geode.internal.util.concurrent.CustomEntryConcurrentHashMap.Ha
* 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 VersionedStatsLRURegionEntryOffHeapLongKey extends VersionedStatsLRURegionEntryOffHeap {
- public VersionedStatsLRURegionEntryOffHeapLongKey (RegionEntryContext context, long key,
+public class VersionedStatsLRURegionEntryOffHeapLongKey
+ extends VersionedStatsLRURegionEntryOffHeap {
+ public VersionedStatsLRURegionEntryOffHeapLongKey(RegionEntryContext context, long key,
@Retained
@@ -81,57 +71,57 @@ public class VersionedStatsLRURegionEntryOffHeapLongKey extends VersionedStatsLR
- ) {
- 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<VersionedStatsLRURegionEntryOffHeapLongKey> lastModifiedUpdater
- = AtomicLongFieldUpdater.newUpdater(VersionedStatsLRURegionEntryOffHeapLongKey.class, "lastModified");
+ private static final AtomicLongFieldUpdater<VersionedStatsLRURegionEntryOffHeapLongKey> lastModifiedUpdater =
+ AtomicLongFieldUpdater.newUpdater(VersionedStatsLRURegionEntryOffHeapLongKey.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<VersionedStatsLRURegionEntryOffHeapLongKey> ohAddrUpdater = AtomicLongFieldUpdater.newUpdater(VersionedStatsLRURegionEntryOffHeapLongKey.class, "ohAddress");
-
+ private final static AtomicLongFieldUpdater<VersionedStatsLRURegionEntryOffHeapLongKey> ohAddrUpdater =
+ AtomicLongFieldUpdater.newUpdater(VersionedStatsLRURegionEntryOffHeapLongKey.class,
+ "ohAddress");
+
@Override
public Token getValueAsToken() {
return OffHeapRegionEntryHelper.getValueAsToken(this);
}
-
+
@Override
protected Object getValueField() {
return OffHeapRegionEntryHelper._getValue(this);
@@ -147,6 +137,7 @@ public class VersionedStatsLRURegionEntryOffHeapLongKey extends VersionedStatsLR
OffHeapRegionEntryHelper.setValue(this, v);
}
+
@Override
@Retained
@@ -164,7 +155,7 @@ public class VersionedStatsLRURegionEntryOffHeapLongKey extends VersionedStatsLR
public boolean setAddress(long expectedAddr, long newAddr) {
return ohAddrUpdater.compareAndSet(this, expectedAddr, newAddr);
}
-
+
@Override
@Released
@@ -172,36 +163,41 @@ public class VersionedStatsLRURegionEntryOffHeapLongKey extends VersionedStatsLR
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 +205,57 @@ public class VersionedStatsLRURegionEntryOffHeapLongKey extends VersionedStatsLR
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 +265,38 @@ public class VersionedStatsLRURegionEntryOffHeapLongKey extends VersionedStatsLR
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 +305,7 @@ public class VersionedStatsLRURegionEntryOffHeapLongKey extends VersionedStatsLR
// DO NOT modify this class. It was generated from LeafRegionEntry.cpp
-
+
// stats code
@Override
public void updateStatsForGet(boolean hit, long time) {
@@ -309,51 +316,61 @@ public class VersionedStatsLRURegionEntryOffHeapLongKey extends VersionedStatsLR
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<VersionedStatsLRURegionEntryOffHeapLongKey> hitCountUpdater
- = AtomicIntegerFieldUpdater.newUpdater(VersionedStatsLRURegionEntryOffHeapLongKey.class, "hitCount");
- private static final AtomicIntegerFieldUpdater<VersionedStatsLRURegionEntryOffHeapLongKey> missCountUpdater
- = AtomicIntegerFieldUpdater.newUpdater(VersionedStatsLRURegionEntryOffHeapLongKey.class, "missCount");
-
+
+ private static final AtomicIntegerFieldUpdater<VersionedStatsLRURegionEntryOffHeapLongKey> hitCountUpdater =
+ AtomicIntegerFieldUpdater.newUpdater(VersionedStatsLRURegionEntryOffHeapLongKey.class,
+ "hitCount");
+ private static final AtomicIntegerFieldUpdater<VersionedStatsLRURegionEntryOffHeapLongKey> missCountUpdater =
+ AtomicIntegerFieldUpdater.newUpdater(VersionedStatsLRURegionEntryOffHeapLongKey.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,15 +378,16 @@ public class VersionedStatsLRURegionEntryOffHeapLongKey extends VersionedStatsLR
this.hitCount = 0;
this.missCount = 0;
}
+
@Override
public boolean hasStats() {
return true;
}
-
+
// DO NOT modify this class. It was generated from LeafRegionEntry.cpp
-
+
// versioned code
private VersionSource memberID;
private short entryVersionLowBytes;
@@ -381,16 +399,16 @@ public class VersionedStatsLRURegionEntryOffHeapLongKey extends VersionedStatsLR
public int getEntryVersion() {
return ((entryVersionHighByte << 16) & 0xFF0000) | (entryVersionLowBytes & 0xFFFF);
}
-
+
public long getRegionVersion() {
- return (((long)regionVersionHighBytes) << 32) | (regionVersionLowBytes & 0x00000000FFFFFFFFL);
+ return (((long) regionVersionHighBytes) << 32) | (regionVersionLowBytes & 0x00000000FFFFFFFFL);
}
-
-
+
+
public long getVersionTimeStamp() {
return getLastModified();
}
-
+
public void setVersionTimeStamp(long time) {
setLastModified(time);
}
@@ -398,17 +416,18 @@ public class VersionedStatsLRURegionEntryOffHeapLongKey extends VersionedStatsLR
public VersionSource getMemberID() {
return this.memberID;
}
+
public int getDistributedSystemId() {
return this.distributedSystemId;
}
// DO NOT modify this class. It was generated from LeafRegionEntry.cpp
-
+
public void setVersions(VersionTag tag) {
this.memberID = tag.getMemberID();
int eVersion = tag.getEntryVersion();
- this.entryVersionLowBytes = (short)(eVersion & 0xffff);
- this.entryVersionHighByte = (byte)((eVersion & 0xff0000) >> 16);
+ this.entryVersionLowBytes = (short) (eVersion & 0xffff);
+ this.entryVersionHighByte = (byte) ((eVersion & 0xff0000) >> 16);
this.regionVersionHighBytes = tag.getRegionVersionHighBytes();
this.regionVersionLowBytes = tag.getRegionVersionLowBytes();
if (!(tag.isGatewayTag()) && this.distributedSystemId == tag.getDistributedSystemId()) {
@@ -420,11 +439,11 @@ public class VersionedStatsLRURegionEntryOffHeapLongKey extends VersionedStatsLR
} else {
setVersionTimeStamp(tag.getVersionTimeStamp());
}
- this.distributedSystemId = (byte)(tag.getDistributedSystemId() & 0xff);
+ this.distributedSystemId = (byte) (tag.getDistributedSystemId() & 0xff);
}
public void setMemberID(VersionSource memberID) {
- this.memberID = memberID;
+ this.memberID = memberID;
}
@Override
@@ -433,7 +452,7 @@ public class VersionedStatsLRURegionEntryOffHeapLongKey extends VersionedStatsLR
}
// DO NOT modify this class. It was generated from LeafRegionEntry.cpp
-
+
public VersionTag asVersionTag() {
VersionTag tag = VersionTag.create(memberID);
tag.setEntryVersion(getEntryVersion());
@@ -443,9 +462,9 @@ public class VersionedStatsLRURegionEntryOffHeapLongKey extends VersionedStatsLR
return tag;
}
- public void processVersionTag(LocalRegion r, VersionTag tag,
- boolean isTombstoneFromGII, boolean hasDelta,
- VersionSource thisVM, InternalDistributedMember sender, boolean checkForConflicts) {
+ public void processVersionTag(LocalRegion r, VersionTag tag, boolean isTombstoneFromGII,
+ boolean hasDelta, VersionSource thisVM, InternalDistributedMember sender,
+ boolean checkForConflicts) {
basicProcessVersionTag(r, tag, isTombstoneFromGII, hasDelta, thisVM, sender, checkForConflicts);
}
@@ -460,22 +479,24 @@ public class VersionedStatsLRURegionEntryOffHeapLongKey extends VersionedStatsLR
public short getRegionVersionHighBytes() {
return this.regionVersionHighBytes;
}
-
+
/** get rvv internal low bytes. Used by region entries for transferring to storage */
public int getRegionVersionLowBytes() {
return this.regionVersionLowBytes;
}
-
+
// 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) {
@@ -483,7 +504,7 @@ public class VersionedStatsLRURegionEntryOffHeapLongKey extends VersionedStatsLR
}
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/VersionedStatsLRURegionEntryOffHeapObjectKey.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryOffHeapObjectKey.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryOffHeapObjectKey.java
index 3459dde..5712148 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryOffHeapObjectKey.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryOffHeapObjectKey.java
@@ -18,35 +18,24 @@ package org.apache.geode.internal.cache;
-
-
-
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
import java.util.concurrent.atomic.AtomicLongFieldUpdater;
import org.apache.geode.cache.EntryEvent;
-
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.distributed.internal.membership.InternalDistributedMember;
import org.apache.geode.internal.cache.versions.VersionSource;
import org.apache.geode.internal.cache.versions.VersionStamp;
import org.apache.geode.internal.cache.versions.VersionTag;
-
import org.apache.geode.internal.offheap.OffHeapRegionEntryHelper;
import org.apache.geode.internal.offheap.annotations.Released;
import org.apache.geode.internal.offheap.annotations.Retained;
@@ -72,8 +61,9 @@ import org.apache.geode.internal.util.concurrent.CustomEntryConcurrentHashMap.Ha
* 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 VersionedStatsLRURegionEntryOffHeapObjectKey extends VersionedStatsLRURegionEntryOffHeap {
- public VersionedStatsLRURegionEntryOffHeapObjectKey (RegionEntryContext context, Object key,
+public class VersionedStatsLRURegionEntryOffHeapObjectKey
+ extends VersionedStatsLRURegionEntryOffHeap {
+ public VersionedStatsLRURegionEntryOffHeapObjectKey(RegionEntryContext context, Object key,
@Retained
@@ -81,53 +71,57 @@ public class VersionedStatsLRURegionEntryOffHeapObjectKey extends VersionedStats
- ) {
- 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<VersionedStatsLRURegionEntryOffHeapObjectKey> lastModifiedUpdater
- = AtomicLongFieldUpdater.newUpdater(VersionedStatsLRURegionEntryOffHeapObjectKey.class, "lastModified");
+ private static final AtomicLongFieldUpdater<VersionedStatsLRURegionEntryOffHeapObjectKey> lastModifiedUpdater =
+ AtomicLongFieldUpdater.newUpdater(VersionedStatsLRURegionEntryOffHeapObjectKey.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<VersionedStatsLRURegionEntryOffHeapObjectKey> ohAddrUpdater = AtomicLongFieldUpdater.newUpdater(VersionedStatsLRURegionEntryOffHeapObjectKey.class, "ohAddress");
-
+ private final static AtomicLongFieldUpdater<VersionedStatsLRURegionEntryOffHeapObjectKey> ohAddrUpdater =
+ AtomicLongFieldUpdater.newUpdater(VersionedStatsLRURegionEntryOffHeapObjectKey.class,
+ "ohAddress");
+
@Override
public Token getValueAsToken() {
return OffHeapRegionEntryHelper.getValueAsToken(this);
}
-
+
@Override
protected Object getValueField() {
return OffHeapRegionEntryHelper._getValue(this);
@@ -143,6 +137,7 @@ public class VersionedStatsLRURegionEntryOffHeapObjectKey extends VersionedStats
OffHeapRegionEntryHelper.setValue(this, v);
}
+
@Override
@Retained
@@ -160,7 +155,7 @@ public class VersionedStatsLRURegionEntryOffHeapObjectKey extends VersionedStats
public boolean setAddress(long expectedAddr, long newAddr) {
return ohAddrUpdater.compareAndSet(this, expectedAddr, newAddr);
}
-
+
@Override
@Released
@@ -168,36 +163,41 @@ public class VersionedStatsLRURegionEntryOffHeapObjectKey extends VersionedStats
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 +205,57 @@ public class VersionedStatsLRURegionEntryOffHeapObjectKey extends VersionedStats
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 +265,33 @@ public class VersionedStatsLRURegionEntryOffHeapObjectKey extends VersionedStats
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 +300,12 @@ public class VersionedStatsLRURegionEntryOffHeapObjectKey extends VersionedStats
-
}
// DO NOT modify this class. It was generated from LeafRegionEntry.cpp
-
+
// stats code
@Override
public void updateStatsForGet(boolean hit, long time) {
@@ -305,51 +316,61 @@ public class VersionedStatsLRURegionEntryOffHeapObjectKey extends VersionedStats
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<VersionedStatsLRURegionEntryOffHeapObjectKey> hitCountUpdater
- = AtomicIntegerFieldUpdater.newUpdater(VersionedStatsLRURegionEntryOffHeapObjectKey.class, "hitCount");
- private static final AtomicIntegerFieldUpdater<VersionedStatsLRURegionEntryOffHeapObjectKey> missCountUpdater
- = AtomicIntegerFieldUpdater.newUpdater(VersionedStatsLRURegionEntryOffHeapObjectKey.class, "missCount");
-
+
+ private static final AtomicIntegerFieldUpdater<VersionedStatsLRURegionEntryOffHeapObjectKey> hitCountUpdater =
+ AtomicIntegerFieldUpdater.newUpdater(VersionedStatsLRURegionEntryOffHeapObjectKey.class,
+ "hitCount");
+ private static final AtomicIntegerFieldUpdater<VersionedStatsLRURegionEntryOffHeapObjectKey> missCountUpdater =
+ AtomicIntegerFieldUpdater.newUpdater(VersionedStatsLRURegionEntryOffHeapObjectKey.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,15 +378,16 @@ public class VersionedStatsLRURegionEntryOffHeapObjectKey extends VersionedStats
this.hitCount = 0;
this.missCount = 0;
}
+
@Override
public boolean hasStats() {
return true;
}
-
+
// DO NOT modify this class. It was generated from LeafRegionEntry.cpp
-
+
// versioned code
private VersionSource memberID;
private short entryVersionLowBytes;
@@ -377,16 +399,16 @@ public class VersionedStatsLRURegionEntryOffHeapObjectKey extends VersionedStats
public int getEntryVersion() {
return ((entryVersionHighByte << 16) & 0xFF0000) | (entryVersionLowBytes & 0xFFFF);
}
-
+
public long getRegionVersion() {
- return (((long)regionVersionHighBytes) << 32) | (regionVersionLowBytes & 0x00000000FFFFFFFFL);
+ return (((long) regionVersionHighBytes) << 32) | (regionVersionLowBytes & 0x00000000FFFFFFFFL);
}
-
-
+
+
public long getVersionTimeStamp() {
return getLastModified();
}
-
+
public void setVersionTimeStamp(long time) {
setLastModified(time);
}
@@ -394,17 +416,18 @@ public class VersionedStatsLRURegionEntryOffHeapObjectKey extends VersionedStats
public VersionSource getMemberID() {
return this.memberID;
}
+
public int getDistributedSystemId() {
return this.distributedSystemId;
}
// DO NOT modify this class. It was generated from LeafRegionEntry.cpp
-
+
public void setVersions(VersionTag tag) {
this.memberID = tag.getMemberID();
int eVersion = tag.getEntryVersion();
- this.entryVersionLowBytes = (short)(eVersion & 0xffff);
- this.entryVersionHighByte = (byte)((eVersion & 0xff0000) >> 16);
+ this.entryVersionLowBytes = (short) (eVersion & 0xffff);
+ this.entryVersionHighByte = (byte) ((eVersion & 0xff0000) >> 16);
this.regionVersionHighBytes = tag.getRegionVersionHighBytes();
this.regionVersionLowBytes = tag.getRegionVersionLowBytes();
if (!(tag.isGatewayTag()) && this.distributedSystemId == tag.getDistributedSystemId()) {
@@ -416,11 +439,11 @@ public class VersionedStatsLRURegionEntryOffHeapObjectKey extends VersionedStats
} else {
setVersionTimeStamp(tag.getVersionTimeStamp());
}
- this.distributedSystemId = (byte)(tag.getDistributedSystemId() & 0xff);
+ this.distributedSystemId = (byte) (tag.getDistributedSystemId() & 0xff);
}
public void setMemberID(VersionSource memberID) {
- this.memberID = memberID;
+ this.memberID = memberID;
}
@Override
@@ -429,7 +452,7 @@ public class VersionedStatsLRURegionEntryOffHeapObjectKey extends VersionedStats
}
// DO NOT modify this class. It was generated from LeafRegionEntry.cpp
-
+
public VersionTag asVersionTag() {
VersionTag tag = VersionTag.create(memberID);
tag.setEntryVersion(getEntryVersion());
@@ -439,9 +462,9 @@ public class VersionedStatsLRURegionEntryOffHeapObjectKey extends VersionedStats
return tag;
}
- public void processVersionTag(LocalRegion r, VersionTag tag,
- boolean isTombstoneFromGII, boolean hasDelta,
- VersionSource thisVM, InternalDistributedMember sender, boolean checkForConflicts) {
+ public void processVersionTag(LocalRegion r, VersionTag tag, boolean isTombstoneFromGII,
+ boolean hasDelta, VersionSource thisVM, InternalDistributedMember sender,
+ boolean checkForConflicts) {
basicProcessVersionTag(r, tag, isTombstoneFromGII, hasDelta, thisVM, sender, checkForConflicts);
}
@@ -456,18 +479,19 @@ public class VersionedStatsLRURegionEntryOffHeapObjectKey extends VersionedStats
public short getRegionVersionHighBytes() {
return this.regionVersionHighBytes;
}
-
+
/** get rvv internal low bytes. Used by region entries for transferring to storage */
public int getRegionVersionLowBytes() {
return this.regionVersionLowBytes;
}
-
+
// 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/VersionedStatsLRURegionEntryOffHeapStringKey1.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryOffHeapStringKey1.java b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryOffHeapStringKey1.java
index 8090ffc..410cbee 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryOffHeapStringKey1.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/VersionedStatsLRURegionEntryOffHeapStringKey1.java
@@ -18,35 +18,24 @@ package org.apache.geode.internal.cache;
-
-
-
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
import java.util.concurrent.atomic.AtomicLongFieldUpdater;
import org.apache.geode.cache.EntryEvent;
-
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.distributed.internal.membership.InternalDistributedMember;
import org.apache.geode.internal.cache.versions.VersionSource;
import org.apache.geode.internal.cache.versions.VersionStamp;
import org.apache.geode.internal.cache.versions.VersionTag;
-
import org.apache.geode.internal.offheap.OffHeapRegionEntryHelper;
import org.apache.geode.internal.offheap.annotations.Released;
import org.apache.geode.internal.offheap.annotations.Retained;
@@ -72,8 +61,9 @@ import org.apache.geode.internal.util.concurrent.CustomEntryConcurrentHashMap.Ha
* 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 VersionedStatsLRURegionEntryOffHeapStringKey1 extends VersionedStatsLRURegionEntryOffHeap {
- public VersionedStatsLRURegionEntryOffHeapStringKey1 (RegionEntryContext context, String key,
+public class VersionedStatsLRURegionEntryOffHeapStringKey1
+ extends VersionedStatsLRURegionEntryOffHeap {
+ public VersionedStatsLRURegionEntryOffHeapStringKey1(RegionEntryContext context, String key,
@Retained
@@ -81,27 +71,28 @@ public class VersionedStatsLRURegionEntryOffHeapStringKey1 extends VersionedStat
, 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 +103,40 @@ public class VersionedStatsLRURegionEntryOffHeapStringKey1 extends VersionedStat
}
// 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<VersionedStatsLRURegionEntryOffHeapStringKey1> lastModifiedUpdater
- = AtomicLongFieldUpdater.newUpdater(VersionedStatsLRURegionEntryOffHeapStringKey1.class, "lastModified");
+ private static final AtomicLongFieldUpdater<VersionedStatsLRURegionEntryOffHeapStringKey1> lastModifiedUpdater =
+ AtomicLongFieldUpdater.newUpdater(VersionedStatsLRURegionEntryOffHeapStringKey1.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<VersionedStatsLRURegionEntryOffHeapStringKey1> ohAddrUpdater = AtomicLongFieldUpdater.newUpdater(VersionedStatsLRURegionEntryOffHeapStringKey1.class, "ohAddress");
-
+ private final static AtomicLongFieldUpdater<VersionedStatsLRURegionEntryOffHeapStringKey1> ohAddrUpdater =
+ AtomicLongFieldUpdater.newUpdater(VersionedStatsLRURegionEntryOffHeapStringKey1.class,
+ "ohAddress");
+
@Override
public Token getValueAsToken() {
return OffHeapRegionEntryHelper.getValueAsToken(this);
}
-
+
@Override
protected Object getValueField() {
return OffHeapRegionEntryHelper._getValue(this);
@@ -156,6 +152,7 @@ public class VersionedStatsLRURegionEntryOffHeapStringKey1 extends VersionedStat
OffHeapRegionEntryHelper.setValue(this, v);
}
+
@Override
@Retained
@@ -173,7 +170,7 @@ public class VersionedStatsLRURegionEntryOffHeapStringKey1 extends VersionedStat
public boolean setAddress(long expectedAddr, long newAddr) {
return ohAddrUpdater.compareAndSet(this, expectedAddr, newAddr);
}
-
+
@Override
@Released
@@ -181,36 +178,41 @@ public class VersionedStatsLRURegionEntryOffHeapStringKey1 extends VersionedStat
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 +220,57 @@ public class VersionedStatsLRURegionEntryOffHeapStringKey1 extends VersionedStat
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 +280,38 @@ public class VersionedStatsLRURegionEntryOffHeapStringKey1 extends VersionedStat
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 +320,7 @@ public class VersionedStatsLRURegionEntryOffHeapStringKey1 extends VersionedStat
// DO NOT modify this class. It was generated from LeafRegionEntry.cpp
-
+
// stats code
@Override
public void updateStatsForGet(boolean hit, long time) {
@@ -318,51 +331,61 @@ public class VersionedStatsLRURegionEntryOffHeapStringKey1 extends VersionedStat
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<VersionedStatsLRURegionEntryOffHeapStringKey1> hitCountUpdater
- = AtomicIntegerFieldUpdater.newUpdater(VersionedStatsLRURegionEntryOffHeapStringKey1.class, "hitCount");
- private static final AtomicIntegerFieldUpdater<VersionedStatsLRURegionEntryOffHeapStringKey1> missCountUpdater
- = AtomicIntegerFieldUpdater.newUpdater(VersionedStatsLRURegionEntryOffHeapStringKey1.class, "missCount");
-
+
+ private static final AtomicIntegerFieldUpdater<VersionedStatsLRURegionEntryOffHeapStringKey1> hitCountUpdater =
+ AtomicIntegerFieldUpdater.newUpdater(VersionedStatsLRURegionEntryOffHeapStringKey1.class,
+ "hitCount");
+ private static final AtomicIntegerFieldUpdater<VersionedStatsLRURegionEntryOffHeapStringKey1> missCountUpdater =
+ AtomicIntegerFieldUpdater.newUpdater(VersionedStatsLRURegionEntryOffHeapStringKey1.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,15 +393,16 @@ public class VersionedStatsLRURegionEntryOffHeapStringKey1 extends VersionedStat
this.hitCount = 0;
this.missCount = 0;
}
+
@Override
public boolean hasStats() {
return true;
}
-
+
// DO NOT modify this class. It was generated from LeafRegionEntry.cpp
-
+
// versioned code
private VersionSource memberID;
private short entryVersionLowBytes;
@@ -390,16 +414,16 @@ public class VersionedStatsLRURegionEntryOffHeapStringKey1 extends VersionedStat
public int getEntryVersion() {
return ((entryVersionHighByte << 16) & 0xFF0000) | (entryVersionLowBytes & 0xFFFF);
}
-
+
public long getRegionVersion() {
- return (((long)regionVersionHighBytes) << 32) | (regionVersionLowBytes & 0x00000000FFFFFFFFL);
+ return (((long) regionVersionHighBytes) << 32) | (regionVersionLowBytes & 0x00000000FFFFFFFFL);
}
-
-
+
+
public long getVersionTimeStamp() {
return getLastModified();
}
-
+
public void setVersionTimeStamp(long time) {
setLastModified(time);
}
@@ -407,17 +431,18 @@ public class VersionedStatsLRURegionEntryOffHeapStringKey1 extends VersionedStat
public VersionSource getMemberID() {
return this.memberID;
}
+
public int getDistributedSystemId() {
return this.distributedSystemId;
}
// DO NOT modify this class. It was generated from LeafRegionEntry.cpp
-
+
public void setVersions(VersionTag tag) {
this.memberID = tag.getMemberID();
int eVersion = tag.getEntryVersion();
- this.entryVersionLowBytes = (short)(eVersion & 0xffff);
- this.entryVersionHighByte = (byte)((eVersion & 0xff0000) >> 16);
+ this.entryVersionLowBytes = (short) (eVersion & 0xffff);
+ this.entryVersionHighByte = (byte) ((eVersion & 0xff0000) >> 16);
this.regionVersionHighBytes = tag.getRegionVersionHighBytes();
this.regionVersionLowBytes = tag.getRegionVersionLowBytes();
if (!(tag.isGatewayTag()) && this.distributedSystemId == tag.getDistributedSystemId()) {
@@ -429,11 +454,11 @@ public class VersionedStatsLRURegionEntryOffHeapStringKey1 extends VersionedStat
} else {
setVersionTimeStamp(tag.getVersionTimeStamp());
}
- this.distributedSystemId = (byte)(tag.getDistributedSystemId() & 0xff);
+ this.distributedSystemId = (byte) (tag.getDistributedSystemId() & 0xff);
}
public void setMemberID(VersionSource memberID) {
- this.memberID = memberID;
+ this.memberID = memberID;
}
@Override
@@ -442,7 +467,7 @@ public class VersionedStatsLRURegionEntryOffHeapStringKey1 extends VersionedStat
}
// DO NOT modify this class. It was generated from LeafRegionEntry.cpp
-
+
public VersionTag asVersionTag() {
VersionTag tag = VersionTag.create(memberID);
tag.setEntryVersion(getEntryVersion());
@@ -452,9 +477,9 @@ public class VersionedStatsLRURegionEntryOffHeapStringKey1 extends VersionedStat
return tag;
}
- public void processVersionTag(LocalRegion r, VersionTag tag,
- boolean isTombstoneFromGII, boolean hasDelta,
- VersionSource thisVM, InternalDistributedMember sender, boolean checkForConflicts) {
+ public void processVersionTag(LocalRegion r, VersionTag tag, boolean isTombstoneFromGII,
+ boolean hasDelta, VersionSource thisVM, InternalDistributedMember sender,
+ boolean checkForConflicts) {
basicProcessVersionTag(r, tag, isTombstoneFromGII, hasDelta, thisVM, sender, checkForConflicts);
}
@@ -469,38 +494,41 @@ public class VersionedStatsLRURegionEntryOffHeapStringKey1 extends VersionedStat
public short getRegionVersionHighBytes() {
return this.regionVersionHighBytes;
}
-
+
/** get rvv internal low bytes. Used by region entries for transferring to storage */
public int getRegionVersionLowBytes() {
return this.regionVersionLowBytes;
}
-
+
// 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);
}
@@ -509,16 +537,16 @@ public class VersionedStatsLRURegionEntryOffHeapStringKey1 extends VersionedStat
}
// 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) {
@@ -526,7 +554,7 @@ public class VersionedStatsLRURegionEntryOffHeapStringKey1 extends VersionedStat
}
}
} 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) {
@@ -539,7 +567,7 @@ public class VersionedStatsLRURegionEntryOffHeapStringKey1 extends VersionedStat
}
return false;
}
-
+
// DO NOT modify this class. It was generated from LeafRegionEntry.cpp
}