You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by ds...@apache.org on 2016/03/05 01:51:19 UTC
[19/38] incubator-geode git commit: fixed a bug in getOffHeapNewValue
and getOffHeapOldValue that caused them to return null when the value was
stored in an address
fixed a bug in getOffHeapNewValue and getOffHeapOldValue that caused them to return null
when the value was stored in an address
Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/f97fd21b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/f97fd21b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/f97fd21b
Branch: refs/heads/feature/GEODE-982
Commit: f97fd21bc215cdb67baee6e881e9a59df5af25d7
Parents: 9904fc6
Author: Darrel Schneider <ds...@pivotal.io>
Authored: Tue Mar 1 16:24:07 2016 -0800
Committer: Darrel Schneider <ds...@pivotal.io>
Committed: Tue Mar 1 16:24:07 2016 -0800
----------------------------------------------------------------------
.../gemfire/internal/cache/EntryEventImpl.java | 31 ++++++++------------
1 file changed, 13 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f97fd21b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/EntryEventImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/EntryEventImpl.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/EntryEventImpl.java
index e8ca3ce..37a6cf0 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/EntryEventImpl.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/EntryEventImpl.java
@@ -1519,16 +1519,7 @@ public class EntryEventImpl
*/
@Retained(ENTRY_EVENT_NEW_VALUE)
public StoredObject getOffHeapNewValue() {
- final Object tmp = basicGetNewValue();
- if (tmp instanceof ObjectStoredOffHeap) {
- ObjectStoredOffHeap result = (ObjectStoredOffHeap) tmp;
- if (!result.retain()) {
- return null;
- }
- return result;
- } else {
- return null;
- }
+ return convertToStoredObject(basicGetNewValue());
}
/**
@@ -1537,18 +1528,22 @@ public class EntryEventImpl
*/
@Retained(ENTRY_EVENT_OLD_VALUE)
public StoredObject getOffHeapOldValue() {
- final Object tmp = basicGetOldValue();
- if (tmp instanceof ObjectStoredOffHeap) {
- ObjectStoredOffHeap result = (ObjectStoredOffHeap) tmp;
- if (!result.retain()) {
+ return convertToStoredObject(basicGetOldValue());
+ }
+
+ private static StoredObject convertToStoredObject(final Object tmp) {
+ if (!(tmp instanceof StoredObject)) {
+ return null;
+ }
+ StoredObject result = (StoredObject) tmp;
+ if (result instanceof ObjectStoredOffHeap) {
+ if (!((ObjectStoredOffHeap) result).retain()) {
return null;
}
- return result;
- } else {
- return null;
}
+ return result;
}
-
+
/**
* Result may be unretained because sqlf getDeserializedForReading returns unretained.
*/