geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jinmeil...@apache.org
Subject [30/50] [abbrv] incubator-geode git commit: GEODE-1095: GatewaySenderEventImpl now caches serialized value size
Date Tue, 29 Mar 2016 22:26:00 GMT
GEODE-1095: GatewaySenderEventImpl now caches serialized value size


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

Branch: refs/heads/feature/GEODE-17-3
Commit: 05cd14437ecc3391505acf0ef158be3a5dda619f
Parents: ff69aea
Author: Barry Oglesby <boglesby@pivotal.io>
Authored: Wed Mar 16 13:40:31 2016 -0700
Committer: Barry Oglesby <boglesby@pivotal.io>
Committed: Thu Mar 17 10:11:47 2016 -0700

----------------------------------------------------------------------
 .../internal/cache/wan/GatewaySenderEventImpl.java  | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05cd1443/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/wan/GatewaySenderEventImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/wan/GatewaySenderEventImpl.java
b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/wan/GatewaySenderEventImpl.java
index 6f284b5..d1a887f 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/wan/GatewaySenderEventImpl.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/wan/GatewaySenderEventImpl.java
@@ -213,6 +213,10 @@ public class GatewaySenderEventImpl implements
   
   private static final int OP_DETAIL_REMOVEALL = 14;
 
+  private static final int DEFAULT_SERIALIZED_VALUE_SIZE = -1;
+
+  private volatile int serializedValueSize = DEFAULT_SERIALIZED_VALUE_SIZE;
+
 //  /**
 //   * Is this thread in the process of deserializing this event?
 //   */
@@ -1223,17 +1227,23 @@ public class GatewaySenderEventImpl implements
   }
 
   public int getSerializedValueSize() {
+    int localSerializedValueSize = this.serializedValueSize;
+    if (localSerializedValueSize != DEFAULT_SERIALIZED_VALUE_SIZE) {
+      return localSerializedValueSize;
+    }
     @Unretained(OffHeapIdentifier.GATEWAY_SENDER_EVENT_IMPL_VALUE)
     Object vo = this.valueObj;
     if (vo instanceof StoredObject) {
-      return ((StoredObject) vo).getSizeInBytes();
+      localSerializedValueSize = ((StoredObject) vo).getSizeInBytes();
     } else {
       if (this.substituteValue != null) {
-        return sizeOf(this.substituteValue);
+        localSerializedValueSize = sizeOf(this.substituteValue);
       } else {
-      return CachedDeserializableFactory.calcMemSize(getSerializedValue());
+        localSerializedValueSize = CachedDeserializableFactory.calcMemSize(getSerializedValue());
       }
     }
+    this.serializedValueSize = localSerializedValueSize;
+    return localSerializedValueSize;
   }
   
   @Override


Mime
View raw message