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 11:01:17 UTC
[1/2] ignite git commit: IGNITE-2064 Fixed Usage of Optimize
classloader
Repository: ignite
Updated Branches:
refs/heads/ignite-1.5 5ea19a454 -> afbb0dc0c
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-1.5
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;
}
}
[2/2] ignite git commit: IGNITE-2064 Fixed Usage of Optimize
classloader test coverage
Posted by sb...@apache.org.
IGNITE-2064 Fixed Usage of Optimize classloader test coverage
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/afbb0dc0
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/afbb0dc0
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/afbb0dc0
Branch: refs/heads/ignite-1.5
Commit: afbb0dc0c1323b1b24d1a6f4f46fc78d255c98a4
Parents: d078655
Author: Anton Vinogradov <av...@apache.org>
Authored: Wed Dec 9 12:59:51 2015 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Wed Dec 9 12:59:51 2015 +0300
----------------------------------------------------------------------
.../internal/portable/BinaryMarshallerSelfTest.java | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/afbb0dc0/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryMarshallerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryMarshallerSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryMarshallerSelfTest.java
index a06e6c3..d667e07 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryMarshallerSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryMarshallerSelfTest.java
@@ -80,6 +80,7 @@ import sun.misc.Unsafe;
import static org.apache.ignite.internal.portable.streams.PortableMemoryAllocator.INSTANCE;
import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertNotEquals;
/**
* Portable marshaller tests.
@@ -329,6 +330,17 @@ public class BinaryMarshallerSelfTest extends GridCommonAbstractTest {
/**
* @throws Exception If failed.
*/
+ public void testException() throws Exception {
+ Exception ex = new RuntimeException();
+
+ // Checks that Optimize marshaller will be used, because Throwable has writeObject method.
+ // Exception's stacktrace equals to zero-length array by default and generates at Throwable's writeObject method.
+ assertNotEquals(0, marshalUnmarshal(ex).getStackTrace().length);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
public void testCollection() throws Exception {
testCollection(new ArrayList<Integer>(3));
testCollection(new LinkedHashSet<Integer>());
@@ -2406,7 +2418,7 @@ public class BinaryMarshallerSelfTest extends GridCommonAbstractTest {
protected boolean compactFooter() {
return true;
}
-
+
/**
* @param marsh Marshaller.
* @return Portable context.