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

[15/20] ignite git commit: IGNITE-2064 Fixed Usage of Optimize classloader

IGNITE-2064 Fixed Usage of Optimize classloader


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

Branch: refs/heads/ignite-1537
Commit: d0786551aef92f77cbb23097de18745399d00d69
Parents: 5ea19a4
Author: Anton Vinogradov <av...@apache.org>
Authored: Tue Dec 8 16:39:36 2015 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Wed Dec 9 12:55:06 2015 +0300

----------------------------------------------------------------------
 .../portable/PortableClassDescriptor.java       | 46 ++++++++++----------
 1 file changed, 23 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/d0786551/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableClassDescriptor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableClassDescriptor.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableClassDescriptor.java
index 984f7c9..ed65e63 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableClassDescriptor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableClassDescriptor.java
@@ -17,13 +17,6 @@
 
 package org.apache.ignite.internal.portable;
 
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.internal.processors.cache.CacheObjectImpl;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.marshaller.MarshallerExclusions;
-import org.apache.ignite.marshaller.optimized.OptimizedMarshaller;
-import org.jetbrains.annotations.Nullable;
-
 import java.io.Externalizable;
 import java.io.IOException;
 import java.io.ObjectInputStream;
@@ -43,10 +36,16 @@ import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Map;
 import java.util.UUID;
-import org.apache.ignite.binary.BinaryObjectException;
+import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.binary.BinaryIdMapper;
-import org.apache.ignite.binary.Binarylizable;
+import org.apache.ignite.binary.BinaryObjectException;
 import org.apache.ignite.binary.BinarySerializer;
+import org.apache.ignite.binary.Binarylizable;
+import org.apache.ignite.internal.processors.cache.CacheObjectImpl;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.marshaller.MarshallerExclusions;
+import org.apache.ignite.marshaller.optimized.OptimizedMarshaller;
+import org.jetbrains.annotations.Nullable;
 
 import static java.lang.reflect.Modifier.isStatic;
 import static java.lang.reflect.Modifier.isTransient;
@@ -268,11 +267,11 @@ public class PortableClassDescriptor {
                         }
                     }
                 }
-                
+
                 fields = fields0.toArray(new BinaryFieldAccessor[fields0.size()]);
-                
+
                 stableSchema = schemaBuilder.build();
-                
+
                 break;
 
             default:
@@ -796,19 +795,20 @@ public class PortableClassDescriptor {
      * @return {@code true} if to use, {@code false} otherwise.
      */
     private boolean initUseOptimizedMarshallerFlag() {
-       boolean use;
-
-        try {
-            Method writeObj = cls.getDeclaredMethod("writeObject", ObjectOutputStream.class);
-            Method readObj = cls.getDeclaredMethod("readObject", ObjectInputStream.class);
+        for (Class c = cls; !c.equals(Object.class); c = c.getSuperclass()) {
+            try {
+                Method writeObj = c.getDeclaredMethod("writeObject", ObjectOutputStream.class);
+                Method readObj = c.getDeclaredMethod("readObject", ObjectInputStream.class);
 
-            use = !Modifier.isStatic(writeObj.getModifiers()) && !Modifier.isStatic(readObj.getModifiers()) &&
-                writeObj.getReturnType() == void.class && readObj.getReturnType() == void.class;
-        }
-        catch (NoSuchMethodException e) {
-            use = false;
+                if (!Modifier.isStatic(writeObj.getModifiers()) && !Modifier.isStatic(readObj.getModifiers()) &&
+                    writeObj.getReturnType() == void.class && readObj.getReturnType() == void.class)
+                    return true;
+            }
+            catch (NoSuchMethodException e) {
+                // No-op.
+            }
         }
 
-        return use;
+        return false;
     }
 }