You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vo...@apache.org on 2015/12/14 13:30:31 UTC

ignite git commit: IGNITE-2100:: Fixed marshalling.

Repository: ignite
Updated Branches:
  refs/heads/ignite-2100 e92fb51c7 -> 705349fdf


IGNITE-2100:: Fixed marshalling.


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

Branch: refs/heads/ignite-2100
Commit: 705349fdfa9494fda622052995ed643b33baafc6
Parents: e92fb51
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Mon Dec 14 15:30:59 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Mon Dec 14 15:30:59 2015 +0300

----------------------------------------------------------------------
 .../internal/binary/BinaryClassDescriptor.java  | 39 +++++++++++++++++---
 1 file changed, 33 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/705349fd/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryClassDescriptor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryClassDescriptor.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryClassDescriptor.java
index 1c28ab8..84836bd 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryClassDescriptor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryClassDescriptor.java
@@ -163,17 +163,27 @@ public class BinaryClassDescriptor {
 
         excluded = MarshallerExclusions.isExcluded(cls);
 
-        useOptMarshaller = !predefined && initUseOptimizedMarshallerFlag();
+        useOptMarshaller = !predefined && useDfltSerialization && initUseOptimizedMarshallerFlag();
+
+        BinaryWriteMode mode0;
 
         if (excluded)
-            mode = BinaryWriteMode.EXCLUSION;
+            mode0 = BinaryWriteMode.EXCLUSION;
         else {
             if (cls == BinaryEnumObjectImpl.class)
-                mode = BinaryWriteMode.BINARY_ENUM;
+                mode0 = BinaryWriteMode.BINARY_ENUM;
             else
-                mode = serializer != null ? BinaryWriteMode.BINARY : BinaryUtils.mode(cls);
+                mode0 = serializer != null ? BinaryWriteMode.BINARY : BinaryUtils.mode(cls);
+        }
+
+        if (!useDfltSerialization && mode0 == BinaryWriteMode.EXTERNALIZABLE) {
+            mode0 = BinaryWriteMode.OBJECT;
+
+            // TODO: Warning.
         }
 
+        mode = mode0;
+
         switch (mode) {
             case P_BYTE:
             case P_BOOLEAN:
@@ -288,8 +298,25 @@ public class BinaryClassDescriptor {
 
         if (mode == BinaryWriteMode.BINARY || mode == BinaryWriteMode.EXTERNALIZABLE ||
             mode == BinaryWriteMode.OBJECT) {
-            readResolveMtd = U.findNonPublicMethod(cls, "readResolve");
-            writeReplaceMtd = U.findNonPublicMethod(cls, "writeReplace");
+            Method readResolveMtd0 = U.findNonPublicMethod(cls, "readResolve");
+            Method writeReplaceMtd0 = U.findNonPublicMethod(cls, "writeReplace");
+
+            if (useDfltSerialization) {
+                readResolveMtd = readResolveMtd0;
+                writeReplaceMtd = writeReplaceMtd0;
+            }
+            else {
+                if (readResolveMtd0 != null) {
+                    // TODO: WARN
+                }
+
+                if (writeReplaceMtd0 != null) {
+                    // TODO: WARN
+                }
+
+                readResolveMtd = null;
+                writeReplaceMtd = null;
+            }
         }
         else {
             readResolveMtd = null;