ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [07/14] ignite git commit: IGNITE-2225: Fixed unnecessary deserializations.
Date Tue, 22 Dec 2015 19:21:52 GMT
IGNITE-2225: Fixed unnecessary deserializations.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/2c8b259b
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/2c8b259b
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/2c8b259b

Branch: refs/heads/ignite-1537
Commit: 2c8b259b4e0149887ce03e29cd9b2b5f103d1b86
Parents: 73d8b90
Author: vozerov-gridgain <vozerov@gridgain.com>
Authored: Tue Dec 22 15:05:24 2015 +0300
Committer: vozerov-gridgain <vozerov@gridgain.com>
Committed: Tue Dec 22 15:05:24 2015 +0300

----------------------------------------------------------------------
 .../ignite/internal/binary/GridBinaryMarshaller.java      | 10 ++++++++++
 .../cache/binary/CacheObjectBinaryProcessorImpl.java      |  3 +++
 2 files changed, 13 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/2c8b259b/modules/core/src/main/java/org/apache/ignite/internal/binary/GridBinaryMarshaller.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/GridBinaryMarshaller.java
b/modules/core/src/main/java/org/apache/ignite/internal/binary/GridBinaryMarshaller.java
index b21c679..71ca018 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/GridBinaryMarshaller.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/GridBinaryMarshaller.java
@@ -268,6 +268,16 @@ public class GridBinaryMarshaller {
     }
 
     /**
+     * Whether object must be deserialized anyway. I.e. it cannot be converted to BinaryObject.
+     *
+     * @param obj Object.
+     * @return {@code True} if object will be deserialized on unmarshal.
+     */
+    public boolean mustDeserialize(Object obj) {
+        return obj != null && ctx.mustDeserialize(obj.getClass());
+    }
+
+    /**
      * Gets writer for the given output stream.
      *
      * @param out Output stream.

http://git-wip-us.apache.org/repos/asf/ignite/blob/2c8b259b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java
index 6aee7a9..b335179 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/binary/CacheObjectBinaryProcessorImpl.java
@@ -435,6 +435,9 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
             return new GridMapEntry<>(marshalToBinary(e.getKey()), marshalToBinary(e.getValue()));
         }
 
+        if (binaryMarsh.mustDeserialize(obj))
+            return obj; // No need to go through marshal-unmarshal because result will be
the same as initial object.
+
         byte[] arr = binaryMarsh.marshal(obj);
 
         assert arr.length > 0;


Mime
View raw message