geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dschnei...@apache.org
Subject [2/2] incubator-geode git commit: removed unneeded getHeapForm calls and added better var names
Date Mon, 15 Aug 2016 23:27:44 GMT
removed unneeded getHeapForm calls and added better var names


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/707f841c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/707f841c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/707f841c

Branch: refs/heads/feature/GEODE-1691
Commit: 707f841cc332a6e45f158504044ab742b115e682
Parents: 68488b6
Author: Darrel Schneider <dschneider@pivotal.io>
Authored: Mon Aug 15 16:27:20 2016 -0700
Committer: Darrel Schneider <dschneider@pivotal.io>
Committed: Mon Aug 15 16:27:20 2016 -0700

----------------------------------------------------------------------
 .../gemfire/internal/cache/EntryEventImpl.java  | 22 +++++++++++---------
 1 file changed, 12 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/707f841c/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 9dca6b0..bd7596f 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
@@ -741,11 +741,11 @@ public class EntryEventImpl
       boolean doCopyOnRead = getRegion().isCopyOnRead();
       if (ov != null) {
         if (ov instanceof CachedDeserializable) {
-          return callWithOffHeapLock((CachedDeserializable)ov, cd -> {
+          return callWithOffHeapLock((CachedDeserializable)ov, oldValueCD -> {
             if (doCopyOnRead) {
-              return cd.getDeserializedWritableCopy(this.region, this.re);
+              return oldValueCD.getDeserializedWritableCopy(this.region, this.re);
             } else {
-              return cd.getDeserializedValue(this.region, this.re);
+              return oldValueCD.getDeserializedValue(this.region, this.re);
             }
           });
         }
@@ -957,12 +957,12 @@ public class EntryEventImpl
         return AbstractRegion.handleNotAvailable(nv);
       }
       if (nv instanceof CachedDeserializable) {
-        return callWithOffHeapLock((CachedDeserializable)nv, newValue -> {
+        return callWithOffHeapLock((CachedDeserializable)nv, newValueCD -> {
           Object v = null;
           if (doCopyOnRead) {
-            v = newValue.getDeserializedWritableCopy(this.region, this.re);
+            v = newValueCD.getDeserializedWritableCopy(this.region, this.re);
           } else {
-            v = newValue.getDeserializedValue(this.region, this.re);
+            v = newValueCD.getDeserializedValue(this.region, this.re);
           }
           assert !(v instanceof CachedDeserializable) : "for key "+this.getKey()+" found
nested CachedDeserializable";
           return v;
@@ -2592,9 +2592,11 @@ public class EntryEventImpl
      */
     private <R> R callWithOffHeapLock(Function<CachedDeserializable, R> function)
{
       if (this.event != null) {
+        // this call does not use getCd() to access this.cd
+        // because the check for offHeapOk is done by event.callWithOffHeapLock
         return this.event.callWithOffHeapLock(this.cd, function);
       } else {
-        return function.apply(this.cd);
+        return function.apply(getCd());
       }
     }
     
@@ -2603,15 +2605,15 @@ public class EntryEventImpl
       return getDeserializedValue(this.r, this.re);
     }
     public Object getDeserializedForReading() {
-      return OffHeapHelper.getHeapForm(getCd().getDeserializedForReading());
+      return getCd().getDeserializedForReading();
     }
     public Object getDeserializedWritableCopy(Region rgn, RegionEntry entry) {
-      return OffHeapHelper.getHeapForm(getCd().getDeserializedWritableCopy(rgn, entry));
+      return getCd().getDeserializedWritableCopy(rgn, entry);
     }
 
     public Object getDeserializedValue(Region rgn, RegionEntry reentry) {
       return callWithOffHeapLock(cd -> {
-        return OffHeapHelper.getHeapForm(cd.getDeserializedValue(rgn, reentry));
+        return cd.getDeserializedValue(rgn, reentry);
       });
     }
     public Object getValue() {


Mime
View raw message