ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vkuliche...@apache.org
Subject [3/6] incubator-ignite git commit: IGNITE-141 - Marshallers refactoring
Date Sat, 28 Feb 2015 03:48:21 GMT
IGNITE-141 - Marshallers refactoring


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

Branch: refs/heads/ignite-141
Commit: 6d85e75de739c4fd3f8a889a661a8c33130f633a
Parents: e09b037
Author: Valentin Kulichenko <vkulichenko@gridgain.com>
Authored: Wed Feb 25 22:23:35 2015 -0800
Committer: Valentin Kulichenko <vkulichenko@gridgain.com>
Committed: Wed Feb 25 22:23:35 2015 -0800

----------------------------------------------------------------------
 .../CacheRendezvousAffinityFunction.java        |    1 -
 .../org/apache/ignite/internal/GridTopic.java   |   89 +-
 .../GridClientOptimizedMarshaller.java          |   24 +-
 .../affinity/GridAffinityMessage.java           |   13 +-
 .../processors/cache/CacheInvokeResult.java     |   12 +-
 .../processors/cache/GridCacheReturn.java       |   12 +-
 .../IgniteExternalizableExpiryPolicy.java       |   12 +-
 .../jdbc/GridCacheQueryJdbcMetadataTask.java    |   12 +-
 .../query/jdbc/GridCacheQueryJdbcTask.java      |   12 +-
 .../cache/transactions/IgniteTxEntry.java       |   12 +-
 .../cache/version/GridCacheVersion.java         |   12 +-
 .../cache/version/GridCacheVersionEx.java       |    9 -
 .../streamer/GridStreamerExecutionBatch.java    |   12 +-
 .../java/org/apache/ignite/lang/IgniteUuid.java |   13 +-
 .../optimized/OptimizedClassDescriptor.java     |   30 +-
 .../optimized/OptimizedClassResolver.java       |  477 -----
 .../optimized/OptimizedMarshallable.java        |   65 -
 .../optimized/OptimizedMarshaller.java          |  138 +-
 .../optimized/OptimizedMarshallerUtils.java     |  153 +-
 .../optimized/OptimizedObjectInputStream.java   |    4 +-
 .../optimized/OptimizedObjectOutputStream.java  |    7 +-
 .../optimized-classnames.previous.properties    |    0
 .../optimized/optimized-classnames.properties   | 1651 ------------------
 .../cache/GridCacheAffinityRoutingSelfTest.java |    6 -
 .../dataload/GridDataLoaderImplSelfTest.java    |    7 -
 .../streamer/GridStreamerEvictionSelfTest.java  |    1 -
 .../GridMarshallerPerformanceTest.java          |    2 -
 .../optimized/OptimizedMarshallerSelfTest.java  |  170 --
 .../optimized/OptimizedMarshallerTest.java      |   63 -
 .../OptimizedObjectStreamSelfTest.java          |    6 +-
 30 files changed, 86 insertions(+), 2939 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6d85e75d/modules/core/src/main/java/org/apache/ignite/cache/affinity/rendezvous/CacheRendezvousAffinityFunction.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/affinity/rendezvous/CacheRendezvousAffinityFunction.java b/modules/core/src/main/java/org/apache/ignite/cache/affinity/rendezvous/CacheRendezvousAffinityFunction.java
index 87d768f..f7bc2c5 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/affinity/rendezvous/CacheRendezvousAffinityFunction.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/affinity/rendezvous/CacheRendezvousAffinityFunction.java
@@ -21,7 +21,6 @@ import org.apache.ignite.*;
 import org.apache.ignite.cache.affinity.*;
 import org.apache.ignite.cluster.*;
 import org.apache.ignite.internal.*;
-import org.apache.ignite.internal.util.*;
 import org.apache.ignite.internal.util.typedef.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
 import org.apache.ignite.lang.*;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6d85e75d/modules/core/src/main/java/org/apache/ignite/internal/GridTopic.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridTopic.java b/modules/core/src/main/java/org/apache/ignite/internal/GridTopic.java
index 32bab16..06f1653 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridTopic.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridTopic.java
@@ -19,7 +19,6 @@ package org.apache.ignite.internal;
 
 import org.apache.ignite.internal.util.typedef.internal.*;
 import org.apache.ignite.lang.*;
-import org.apache.ignite.marshaller.optimized.*;
 import org.jetbrains.annotations.*;
 
 import java.io.*;
@@ -186,15 +185,11 @@ public enum GridTopic {
     /**
      *
      */
-    private static class T1 implements Externalizable, OptimizedMarshallable {
+    private static class T1 implements Externalizable {
         /** */
         private static final long serialVersionUID = 0L;
 
         /** */
-        @SuppressWarnings({"NonConstantFieldWithUpperCaseName", "AbbreviationUsage", "UnusedDeclaration"})
-        private static Object GG_CLASS_ID;
-
-        /** */
         private GridTopic topic;
 
         /** */
@@ -217,11 +212,6 @@ public enum GridTopic {
         }
 
         /** {@inheritDoc} */
-        @Override public Object ggClassId() {
-            return GG_CLASS_ID;
-        }
-
-        /** {@inheritDoc} */
         @Override public int hashCode() {
             return topic.ordinal() + id.hashCode();
         }
@@ -258,15 +248,11 @@ public enum GridTopic {
     /**
      *
      */
-    private static class T2 implements Externalizable, OptimizedMarshallable {
+    private static class T2 implements Externalizable {
         /** */
         private static final long serialVersionUID = 0L;
 
         /** */
-        @SuppressWarnings({"NonConstantFieldWithUpperCaseName", "AbbreviationUsage", "UnusedDeclaration"})
-        private static Object GG_CLASS_ID;
-
-        /** */
         private GridTopic topic;
 
         /** */
@@ -294,11 +280,6 @@ public enum GridTopic {
         }
 
         /** {@inheritDoc} */
-        @Override public Object ggClassId() {
-            return GG_CLASS_ID;
-        }
-
-        /** {@inheritDoc} */
         @Override public int hashCode() {
             return topic.ordinal() + id1.hashCode() + id2.hashCode();
         }
@@ -337,15 +318,11 @@ public enum GridTopic {
     /**
      *
      */
-    private static class T3 implements Externalizable, OptimizedMarshallable {
+    private static class T3 implements Externalizable {
         /** */
         private static final long serialVersionUID = 0L;
 
         /** */
-        @SuppressWarnings({"NonConstantFieldWithUpperCaseName", "AbbreviationUsage", "UnusedDeclaration"})
-        private static Object GG_CLASS_ID;
-
-        /** */
         private GridTopic topic;
 
         /** */
@@ -384,11 +361,6 @@ public enum GridTopic {
         }
 
         /** {@inheritDoc} */
-        @Override public Object ggClassId() {
-            return GG_CLASS_ID;
-        }
-
-        /** {@inheritDoc} */
         @Override public void writeExternal(ObjectOutput out) throws IOException {
             out.writeByte(topic.ordinal());
             U.writeUuid(out, id1);
@@ -409,15 +381,11 @@ public enum GridTopic {
     /**
      *
      */
-    private static class T4 implements Externalizable, OptimizedMarshallable {
+    private static class T4 implements Externalizable {
         /** */
         private static final long serialVersionUID = 0L;
 
         /** */
-        @SuppressWarnings({"NonConstantFieldWithUpperCaseName", "AbbreviationUsage", "UnusedDeclaration"})
-        private static Object GG_CLASS_ID;
-
-        /** */
         private GridTopic topic;
 
         /** */
@@ -450,11 +418,6 @@ public enum GridTopic {
         }
 
         /** {@inheritDoc} */
-        @Override public Object ggClassId() {
-            return GG_CLASS_ID;
-        }
-
-        /** {@inheritDoc} */
         @Override public int hashCode() {
             return topic.ordinal() + id1.hashCode() + id2.hashCode() + (int)(id3 ^ (id3 >>> 32));
         }
@@ -495,15 +458,11 @@ public enum GridTopic {
     /**
      *
      */
-    private static class T5 implements Externalizable, OptimizedMarshallable {
+    private static class T5 implements Externalizable {
         /** */
         private static final long serialVersionUID = 0L;
 
         /** */
-        @SuppressWarnings({"NonConstantFieldWithUpperCaseName", "AbbreviationUsage", "UnusedDeclaration"})
-        private static Object GG_CLASS_ID;
-
-        /** */
         private GridTopic topic;
 
         /** */
@@ -536,11 +495,6 @@ public enum GridTopic {
         }
 
         /** {@inheritDoc} */
-        @Override public Object ggClassId() {
-            return GG_CLASS_ID;
-        }
-
-        /** {@inheritDoc} */
         @Override public int hashCode() {
             return topic.ordinal() + id1.hashCode() + id2 + (int)(id3 ^ (id3 >>> 32));
         }
@@ -581,15 +535,11 @@ public enum GridTopic {
     /**
      *
      */
-    private static class T6 implements Externalizable, OptimizedMarshallable {
+    private static class T6 implements Externalizable {
         /** */
         private static final long serialVersionUID = 0L;
 
         /** */
-        @SuppressWarnings({"NonConstantFieldWithUpperCaseName", "AbbreviationUsage", "UnusedDeclaration"})
-        private static Object GG_CLASS_ID;
-
-        /** */
         private GridTopic topic;
 
         /** */
@@ -617,11 +567,6 @@ public enum GridTopic {
         }
 
         /** {@inheritDoc} */
-        @Override public Object ggClassId() {
-            return GG_CLASS_ID;
-        }
-
-        /** {@inheritDoc} */
         @Override public int hashCode() {
             return topic.ordinal() + id1.hashCode () + (int)(id2 ^ (id2 >>> 32));
         }
@@ -660,15 +605,11 @@ public enum GridTopic {
     /**
      *
      */
-    private static class T7 implements Externalizable, OptimizedMarshallable {
+    private static class T7 implements Externalizable {
         /** */
         private static final long serialVersionUID = 0L;
 
         /** */
-        @SuppressWarnings({"NonConstantFieldWithUpperCaseName", "AbbreviationUsage", "UnusedDeclaration"})
-        private static Object GG_CLASS_ID;
-
-        /** */
         private GridTopic topic;
 
         /** */
@@ -706,11 +647,6 @@ public enum GridTopic {
         }
 
         /** {@inheritDoc} */
-        @Override public Object ggClassId() {
-            return GG_CLASS_ID;
-        }
-
-        /** {@inheritDoc} */
         @Override public int hashCode() {
             return topic.ordinal() + id1.hashCode() + id2.hashCode() + id3 + (int)(id4 ^ (id4 >>> 32));
         }
@@ -754,15 +690,11 @@ public enum GridTopic {
     /**
      *
      */
-    private static class T8 implements Externalizable, OptimizedMarshallable {
+    private static class T8 implements Externalizable {
         /** */
         private static final long serialVersionUID = 0L;
 
         /** */
-        @SuppressWarnings({"NonConstantFieldWithUpperCaseName", "AbbreviationUsage", "UnusedDeclaration"})
-        private static Object GG_CLASS_ID;
-
-        /** */
         private GridTopic topic;
 
         /** */
@@ -790,11 +722,6 @@ public enum GridTopic {
         }
 
         /** {@inheritDoc} */
-        @Override public Object ggClassId() {
-            return GG_CLASS_ID;
-        }
-
-        /** {@inheritDoc} */
         @Override public int hashCode() {
             return topic.ordinal() + id1.hashCode() + (int)(id2 ^ (id2 >>> 32));
         }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6d85e75d/modules/core/src/main/java/org/apache/ignite/internal/client/marshaller/optimized/GridClientOptimizedMarshaller.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/marshaller/optimized/GridClientOptimizedMarshaller.java b/modules/core/src/main/java/org/apache/ignite/internal/client/marshaller/optimized/GridClientOptimizedMarshaller.java
index c929575..e8b0899 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/client/marshaller/optimized/GridClientOptimizedMarshaller.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/client/marshaller/optimized/GridClientOptimizedMarshaller.java
@@ -19,12 +19,11 @@ package org.apache.ignite.internal.client.marshaller.optimized;
 
 import org.apache.ignite.*;
 import org.apache.ignite.internal.client.marshaller.*;
-import org.apache.ignite.marshaller.optimized.*;
 import org.apache.ignite.internal.processors.rest.client.message.*;
+import org.apache.ignite.marshaller.optimized.*;
 
 import java.io.*;
 import java.nio.*;
-import java.util.*;
 
 /**
  * Wrapper, that adapts {@link org.apache.ignite.marshaller.optimized.OptimizedMarshaller} to
@@ -47,24 +46,17 @@ public class GridClientOptimizedMarshaller implements GridClientMarshaller {
     /**
      * Constructs optimized marshaller with specific parameters.
      *
-     * @param requireSer Flag to enforce {@link Serializable} interface or not. If {@code true},
-     *      then objects will be required to implement {@link Serializable} in order to be
-     *      marshalled, if {@code false}, then such requirement will be relaxed.
-     * @param clsNames User preregistered class names.
-     * @param clsNamesPath Path to a file with user preregistered class names.
+     * @param requireSer Require serializable flag.
      * @param poolSize Object streams pool size.
      * @throws IOException If an I/O error occurs while writing stream header.
      * @throws IgniteException If this marshaller is not supported on the current JVM.
-     * @see org.apache.ignite.marshaller.optimized.OptimizedMarshaller
+     * @see OptimizedMarshaller
      */
-    public GridClientOptimizedMarshaller(boolean requireSer, List<String> clsNames, String clsNamesPath, int poolSize)
-        throws IOException {
-        try {
-            opMarsh = new OptimizedMarshaller(requireSer, clsNames, clsNamesPath, poolSize);
-        }
-        catch (IgniteCheckedException e) {
-            throw new IOException(e);
-        }
+    public GridClientOptimizedMarshaller(boolean requireSer, int poolSize) throws IOException {
+        opMarsh = new OptimizedMarshaller();
+
+        opMarsh.setRequireSerializable(requireSer);
+        opMarsh.setPoolSize(poolSize);
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6d85e75d/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityMessage.java
index 016a792..8378553 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityMessage.java
@@ -18,11 +18,9 @@
 package org.apache.ignite.internal.processors.affinity;
 
 import org.apache.ignite.configuration.*;
-import org.apache.ignite.internal.util.*;
 import org.apache.ignite.internal.util.tostring.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
 import org.apache.ignite.lang.*;
-import org.apache.ignite.marshaller.optimized.*;
 
 import java.io.*;
 import java.util.*;
@@ -30,15 +28,11 @@ import java.util.*;
 /**
  * Object wrapper containing serialized byte array of original object and deployment information.
  */
-class GridAffinityMessage implements Externalizable, OptimizedMarshallable {
+class GridAffinityMessage implements Externalizable {
     /** */
     private static final long serialVersionUID = 0L;
 
     /** */
-    @SuppressWarnings({"NonConstantFieldWithUpperCaseName", "AbbreviationUsage", "UnusedDeclaration"})
-    private static Object GG_CLASS_ID;
-
-    /** */
     private byte[] src;
 
     /** */
@@ -130,11 +124,6 @@ class GridAffinityMessage implements Externalizable, OptimizedMarshallable {
     }
 
     /** {@inheritDoc} */
-    @Override public Object ggClassId() {
-        return GG_CLASS_ID;
-    }
-
-    /** {@inheritDoc} */
     @Override public void writeExternal(ObjectOutput out) throws IOException {
         U.writeByteArray(out, src);
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6d85e75d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeResult.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeResult.java
index 3eb0f5a..422b763 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeResult.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeResult.java
@@ -19,7 +19,6 @@ package org.apache.ignite.internal.processors.cache;
 
 import org.apache.ignite.internal.util.tostring.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
-import org.apache.ignite.marshaller.optimized.*;
 
 import javax.cache.processor.*;
 import java.io.*;
@@ -27,15 +26,11 @@ import java.io.*;
 /**
  * Implementation of {@link EntryProcessorResult}.
  */
-public class CacheInvokeResult<T> implements EntryProcessorResult<T>, Externalizable, OptimizedMarshallable {
+public class CacheInvokeResult<T> implements EntryProcessorResult<T>, Externalizable {
     /** */
     private static final long serialVersionUID = 0L;
 
     /** */
-    @SuppressWarnings({"NonConstantFieldWithUpperCaseName", "JavaAbbreviationUsage", "UnusedDeclaration"})
-    private static Object GG_CLASS_ID;
-
-    /** */
     @GridToStringInclude
     private T res;
 
@@ -64,11 +59,6 @@ public class CacheInvokeResult<T> implements EntryProcessorResult<T>, Externaliz
     }
 
     /** {@inheritDoc} */
-    @Override public Object ggClassId() {
-        return GG_CLASS_ID;
-    }
-
-    /** {@inheritDoc} */
     @Override public T get() throws EntryProcessorException {
         if (err != null) {
             if (err instanceof EntryProcessorException)

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6d85e75d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheReturn.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheReturn.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheReturn.java
index 3e9047c..554d7b1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheReturn.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheReturn.java
@@ -19,7 +19,6 @@ package org.apache.ignite.internal.processors.cache;
 
 import org.apache.ignite.internal.util.tostring.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
-import org.apache.ignite.marshaller.optimized.*;
 import org.jetbrains.annotations.*;
 
 import javax.cache.processor.*;
@@ -29,14 +28,10 @@ import java.util.*;
 /**
  * Return value for cases where both, value and success flag need to be returned.
  */
-public class GridCacheReturn<V> implements Externalizable, OptimizedMarshallable {
+public class GridCacheReturn<V> implements Externalizable {
     /** */
     private static final long serialVersionUID = 0L;
 
-    /** */
-    @SuppressWarnings({"NonConstantFieldWithUpperCaseName", "JavaAbbreviationUsage", "UnusedDeclaration"})
-    private static Object GG_CLASS_ID;
-
     /** Value. */
     @GridToStringInclude
     private volatile V v;
@@ -201,11 +196,6 @@ public class GridCacheReturn<V> implements Externalizable, OptimizedMarshallable
     }
 
     /** {@inheritDoc} */
-    @Override public Object ggClassId() {
-        return GG_CLASS_ID;
-    }
-
-    /** {@inheritDoc} */
     @Override public void writeExternal(ObjectOutput out) throws IOException {
         out.writeBoolean(success);
         out.writeObject(v);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6d85e75d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/IgniteExternalizableExpiryPolicy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/IgniteExternalizableExpiryPolicy.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/IgniteExternalizableExpiryPolicy.java
index f4caaca..000eabc 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/IgniteExternalizableExpiryPolicy.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/IgniteExternalizableExpiryPolicy.java
@@ -18,7 +18,6 @@
 package org.apache.ignite.internal.processors.cache.distributed;
 
 import org.apache.ignite.internal.util.typedef.internal.*;
-import org.apache.ignite.marshaller.optimized.*;
 import org.jetbrains.annotations.*;
 
 import javax.cache.expiry.*;
@@ -28,15 +27,11 @@ import java.util.concurrent.*;
 /**
  * Externalizable wrapper for {@link ExpiryPolicy}.
  */
-public class IgniteExternalizableExpiryPolicy implements ExpiryPolicy, Externalizable, OptimizedMarshallable {
+public class IgniteExternalizableExpiryPolicy implements ExpiryPolicy, Externalizable {
     /** */
     private static final long serialVersionUID = 0L;
 
     /** */
-    @SuppressWarnings({"NonConstantFieldWithUpperCaseName", "AbbreviationUsage", "UnusedDeclaration"})
-    private static Object GG_CLASS_ID;
-
-    /** */
     private ExpiryPolicy plc;
 
     /** */
@@ -74,11 +69,6 @@ public class IgniteExternalizableExpiryPolicy implements ExpiryPolicy, Externali
     }
 
     /** {@inheritDoc} */
-    @Override public Object ggClassId() {
-        return GG_CLASS_ID;
-    }
-
-    /** {@inheritDoc} */
     @Override public Duration getExpiryForCreation() {
         return forCreate;
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6d85e75d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/jdbc/GridCacheQueryJdbcMetadataTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/jdbc/GridCacheQueryJdbcMetadataTask.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/jdbc/GridCacheQueryJdbcMetadataTask.java
index fee601b..43dc81f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/jdbc/GridCacheQueryJdbcMetadataTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/jdbc/GridCacheQueryJdbcMetadataTask.java
@@ -27,7 +27,6 @@ import org.apache.ignite.internal.util.typedef.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
 import org.apache.ignite.marshaller.*;
 import org.apache.ignite.marshaller.jdk.*;
-import org.apache.ignite.marshaller.optimized.*;
 import org.apache.ignite.resources.*;
 import org.jetbrains.annotations.*;
 
@@ -67,14 +66,10 @@ public class GridCacheQueryJdbcMetadataTask extends ComputeTaskAdapter<String, b
     /**
      * Job for JDBC adapter.
      */
-    private static class JdbcDriverMetadataJob extends ComputeJobAdapter implements OptimizedMarshallable {
+    private static class JdbcDriverMetadataJob extends ComputeJobAdapter {
         /** */
         private static final long serialVersionUID = 0L;
 
-        /** */
-        @SuppressWarnings({"NonConstantFieldWithUpperCaseName", "AbbreviationUsage", "UnusedDeclaration"})
-        private static Object GG_CLASS_ID;
-
         /** Cache name. */
         private final String cacheName;
 
@@ -94,11 +89,6 @@ public class GridCacheQueryJdbcMetadataTask extends ComputeTaskAdapter<String, b
         }
 
         /** {@inheritDoc} */
-        @Override public Object ggClassId() {
-            return GG_CLASS_ID;
-        }
-
-        /** {@inheritDoc} */
         @Override public Object execute() {
             byte status;
             byte[] data;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6d85e75d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/jdbc/GridCacheQueryJdbcTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/jdbc/GridCacheQueryJdbcTask.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/jdbc/GridCacheQueryJdbcTask.java
index 4c6f8e4..02fe066 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/jdbc/GridCacheQueryJdbcTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/jdbc/GridCacheQueryJdbcTask.java
@@ -29,7 +29,6 @@ import org.apache.ignite.internal.util.typedef.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
 import org.apache.ignite.marshaller.*;
 import org.apache.ignite.marshaller.jdk.*;
-import org.apache.ignite.marshaller.optimized.*;
 import org.apache.ignite.resources.*;
 
 import java.math.*;
@@ -137,14 +136,10 @@ public class GridCacheQueryJdbcTask extends ComputeTaskAdapter<byte[], byte[]> {
     /**
      * Job for JDBC adapter.
      */
-    private static class JdbcDriverJob extends ComputeJobAdapter implements OptimizedMarshallable {
+    private static class JdbcDriverJob extends ComputeJobAdapter {
         /** */
         private static final long serialVersionUID = 0L;
 
-        /** */
-        @SuppressWarnings({"NonConstantFieldWithUpperCaseName", "AbbreviationUsage", "UnusedDeclaration"})
-        private static Object GG_CLASS_ID;
-
         /** Arguments. */
         private final Map<String, Object> args;
 
@@ -172,11 +167,6 @@ public class GridCacheQueryJdbcTask extends ComputeTaskAdapter<byte[], byte[]> {
         }
 
         /** {@inheritDoc} */
-        @Override public Object ggClassId() {
-            return GG_CLASS_ID;
-        }
-
-        /** {@inheritDoc} */
         @Override public Object execute() {
             try {
                 String cacheName = argument("cache");

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6d85e75d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java
index eb184c9..45cbeb8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java
@@ -27,7 +27,6 @@ import org.apache.ignite.internal.util.tostring.*;
 import org.apache.ignite.internal.util.typedef.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
 import org.apache.ignite.lang.*;
-import org.apache.ignite.marshaller.optimized.*;
 import org.jetbrains.annotations.*;
 
 import javax.cache.*;
@@ -44,14 +43,10 @@ import static org.apache.ignite.internal.processors.cache.GridCacheOperation.*;
  * {@link #equals(Object)} method, as transaction entries should use referential
  * equality.
  */
-public class IgniteTxEntry<K, V> implements GridPeerDeployAware, Externalizable, OptimizedMarshallable {
+public class IgniteTxEntry<K, V> implements GridPeerDeployAware, Externalizable {
     /** */
     private static final long serialVersionUID = 0L;
 
-    /** */
-    @SuppressWarnings({"NonConstantFieldWithUpperCaseName", "AbbreviationUsage", "UnusedDeclaration"})
-    private static Object GG_CLASS_ID;
-
     /** Owning transaction. */
     @GridToStringExclude
     private IgniteInternalTx<K, V> tx;
@@ -901,11 +896,6 @@ public class IgniteTxEntry<K, V> implements GridPeerDeployAware, Externalizable,
     }
 
     /** {@inheritDoc} */
-    @Override public Object ggClassId() {
-        return GG_CLASS_ID;
-    }
-
-    /** {@inheritDoc} */
     @Override public Class<?> deployClass() {
         ClassLoader clsLdr = getClass().getClassLoader();
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6d85e75d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersion.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersion.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersion.java
index 8c37f5a..84b7012 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersion.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersion.java
@@ -19,7 +19,6 @@ package org.apache.ignite.internal.processors.cache.version;
 
 import org.apache.ignite.internal.util.typedef.internal.*;
 import org.apache.ignite.lang.*;
-import org.apache.ignite.marshaller.optimized.*;
 import org.apache.ignite.plugin.extensions.communication.*;
 
 import java.io.*;
@@ -29,14 +28,10 @@ import java.util.*;
 /**
  * Grid unique version.
  */
-public class GridCacheVersion implements Message, Comparable<GridCacheVersion>, Externalizable, OptimizedMarshallable {
+public class GridCacheVersion implements Message, Comparable<GridCacheVersion>, Externalizable {
     /** */
     private static final long serialVersionUID = 0L;
 
-    /** */
-    @SuppressWarnings({"NonConstantFieldWithUpperCaseName", "AbbreviationUsage", "UnusedDeclaration"})
-    private static Object GG_CLASS_ID;
-
     /** Node order mask. */
     private static final int NODE_ORDER_MASK = 0x07_FF_FF_FF;
 
@@ -185,11 +180,6 @@ public class GridCacheVersion implements Message, Comparable<GridCacheVersion>,
         return compareTo(ver) <= 0;
     }
 
-    /** {@inheritDoc} */
-    @Override public Object ggClassId() {
-        return GG_CLASS_ID;
-    }
-
     /**
      * @return Version represented as {@code GridUuid}
      */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6d85e75d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionEx.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionEx.java
index 9a6cbd2..be040b9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionEx.java
@@ -26,10 +26,6 @@ public class GridCacheVersionEx extends GridCacheVersion {
     /** */
     private static final long serialVersionUID = 0L;
 
-    /** */
-    @SuppressWarnings({"NonConstantFieldWithUpperCaseName", "AbbreviationUsage", "UnusedDeclaration"})
-    private static Object GG_CLASS_ID;
-
     /** DR version. */
     private GridCacheVersion drVer;
 
@@ -82,11 +78,6 @@ public class GridCacheVersionEx extends GridCacheVersion {
     }
 
     /** {@inheritDoc} */
-    @Override public Object ggClassId() {
-        return GG_CLASS_ID;
-    }
-
-    /** {@inheritDoc} */
     @Override public void readExternal(ObjectInput in) throws IOException {
         super.readExternal(in);
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6d85e75d/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerExecutionBatch.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerExecutionBatch.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerExecutionBatch.java
index 770fcc2..055ed8f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerExecutionBatch.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerExecutionBatch.java
@@ -21,7 +21,6 @@ import org.apache.ignite.internal.managers.deployment.*;
 import org.apache.ignite.internal.util.tostring.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
 import org.apache.ignite.lang.*;
-import org.apache.ignite.marshaller.optimized.*;
 import org.jetbrains.annotations.*;
 
 import java.io.*;
@@ -30,14 +29,10 @@ import java.util.*;
 /**
  * Streamer execution batch which should be processed on one node.
  */
-public class GridStreamerExecutionBatch implements Externalizable, OptimizedMarshallable {
+public class GridStreamerExecutionBatch implements Externalizable {
     /** */
     private static final long serialVersionUID = 0L;
 
-    /** */
-    @SuppressWarnings({"NonConstantFieldWithUpperCaseName", "AbbreviationUsage", "UnusedDeclaration"})
-    private static Object GG_CLASS_ID;
-
     /** Execution ID (ID of root future). */
     private IgniteUuid execId;
 
@@ -154,11 +149,6 @@ public class GridStreamerExecutionBatch implements Externalizable, OptimizedMars
     }
 
     /** {@inheritDoc} */
-    @Override public Object ggClassId() {
-        return GG_CLASS_ID;
-    }
-
-    /** {@inheritDoc} */
     @Override public void writeExternal(ObjectOutput out) throws IOException {
         U.writeGridUuid(out, execId);
         out.writeLong(execStartTs);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6d85e75d/modules/core/src/main/java/org/apache/ignite/lang/IgniteUuid.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/lang/IgniteUuid.java b/modules/core/src/main/java/org/apache/ignite/lang/IgniteUuid.java
index cb622d9..e36b21f 100644
--- a/modules/core/src/main/java/org/apache/ignite/lang/IgniteUuid.java
+++ b/modules/core/src/main/java/org/apache/ignite/lang/IgniteUuid.java
@@ -20,7 +20,6 @@ package org.apache.ignite.lang;
 import org.apache.ignite.internal.util.lang.*;
 import org.apache.ignite.internal.util.typedef.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
-import org.apache.ignite.marshaller.optimized.*;
 
 import java.io.*;
 import java.util.*;
@@ -31,15 +30,10 @@ import java.util.concurrent.atomic.*;
  * 10x time faster for ID creation. It uses extra memory for 8-byte counter additionally to
  * internal UUID.
  */
-public final class IgniteUuid implements Comparable<IgniteUuid>, Iterable<IgniteUuid>, Cloneable, Externalizable,
-    OptimizedMarshallable {
+public final class IgniteUuid implements Comparable<IgniteUuid>, Iterable<IgniteUuid>, Cloneable, Externalizable {
     /** */
     private static final long serialVersionUID = 0L;
 
-    /** */
-    @SuppressWarnings({"NonConstantFieldWithUpperCaseName", "AbbreviationUsage", "UnusedDeclaration"})
-    private static Object GG_CLASS_ID;
-
     /** VM ID. */
     public static final UUID VM_ID = UUID.randomUUID();
 
@@ -157,11 +151,6 @@ public final class IgniteUuid implements Comparable<IgniteUuid>, Iterable<Ignite
     }
 
     /** {@inheritDoc} */
-    @Override public Object ggClassId() {
-        return GG_CLASS_ID;
-    }
-
-    /** {@inheritDoc} */
     @Override public void writeExternal(ObjectOutput out) throws IOException {
         U.writeUuid(out, gid);
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6d85e75d/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedClassDescriptor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedClassDescriptor.java b/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedClassDescriptor.java
index cbbba5c..90ac2d1 100644
--- a/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedClassDescriptor.java
+++ b/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedClassDescriptor.java
@@ -132,12 +132,6 @@ class OptimizedClassDescriptor {
     /** Class. */
     private Class<?> cls;
 
-    /** Header. */
-    private Integer hdr;
-
-    /** ID. */
-    private Integer id;
-
     /** Short ID. */
     private Short shortId;
 
@@ -210,10 +204,6 @@ class OptimizedClassDescriptor {
 
         excluded = MarshallerExclusions.isExcluded(cls);
 
-        T2<Integer, Integer> t = OptimizedClassResolver.writeClassData(cls);
-
-        hdr = t.get1();
-        id = t.get2();
         name = cls.getName();
 
         if (!excluded) {
@@ -576,20 +566,6 @@ class OptimizedClassDescriptor {
     }
 
     /**
-     * @return Header.
-     */
-    Integer header() {
-        return hdr;
-    }
-
-    /**
-     * @return ID.
-     */
-    Integer id() {
-        return id;
-    }
-
-    /**
      * @return Short ID.
      */
     Short shortId() {
@@ -660,6 +636,8 @@ class OptimizedClassDescriptor {
      */
     @SuppressWarnings("ForLoopReplaceableByForEach")
     void write(OptimizedObjectOutputStream out, Object obj) throws IOException {
+        out.writeInt(cls.getName().hashCode());
+
         switch (type) {
             case TYPE_BYTE:
                 out.writeByte((Byte)obj);
@@ -802,7 +780,7 @@ class OptimizedClassDescriptor {
                 break;
 
             case TYPE_CLS:
-                OptimizedClassResolver.writeClass(out, OptimizedMarshallerUtils.classDescriptor((Class<?>) obj, obj));
+                out.writeInt(((Class<?>)obj).getName().hashCode());
 
                 break;
 
@@ -921,7 +899,7 @@ class OptimizedClassDescriptor {
                 return in.readDate();
 
             case TYPE_CLS:
-                return OptimizedClassResolver.readClass(in, in.classLoader()).describedClass();
+                return null; // TODO: IGNITE-141
 
             case TYPE_EXTERNALIZABLE:
                 return in.readExternalizable(constructor, readResolveMtd);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6d85e75d/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedClassResolver.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedClassResolver.java b/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedClassResolver.java
deleted file mode 100644
index 9a7c981..0000000
--- a/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedClassResolver.java
+++ /dev/null
@@ -1,477 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.marshaller.optimized;
-
-import org.apache.ignite.internal.util.*;
-import org.apache.ignite.internal.util.typedef.*;
-import org.apache.ignite.internal.util.typedef.internal.*;
-import org.apache.ignite.lang.*;
-import org.jdk8.backport.*;
-import org.jetbrains.annotations.*;
-
-import java.io.*;
-import java.math.*;
-import java.sql.*;
-import java.util.*;
-import java.util.Date;
-import java.util.concurrent.*;
-import java.util.concurrent.atomic.*;
-import java.util.concurrent.locks.*;
-
-/**
- * Resolves class names by serialVersionUID.
- */
-@SuppressWarnings({"UnnecessaryFullyQualifiedName", "unchecked"})
-class OptimizedClassResolver {
-    /** File name to generate. */
-    private static final String FILE_NAME = "optimized-classnames.properties";
-
-    /** */
-    private static final Map<String, Integer> ggxName2id = new HashMap<>();
-
-    /** */
-    private static final T2<Class<?>, OptimizedClassDescriptor>[] ggxId2name;
-
-    /** */
-    private static final Map<String, Integer> ggName2id = new HashMap<>();
-
-    /** */
-    private static final T3<String, Class<?>, OptimizedClassDescriptor>[] ggId2name;
-
-    /** */
-    private static Map<String, Integer> usrName2Id;
-
-    /** */
-    private static T3<String, Class<?>, OptimizedClassDescriptor>[] usrId2Name;
-
-    /** */
-    private static final int HEADER_NAME = 255;
-
-    /** */
-    private static final int HEADER_GG_NAME = 254;
-
-    /** */
-    private static final int HEADER_USER_NAME = 253;
-
-    /** */
-    private static final int HEADER_ARRAY = 252;
-
-    /**
-     * Initialize predefined classes to optimize.
-     */
-    static {
-        Class[] superOptCls = new Class[] {
-            // Array types.
-            byte[].class,
-            short[].class,
-            int[].class,
-            long[].class,
-            float[].class,
-            double[].class,
-            boolean[].class,
-            char[].class,
-
-            // Boxed types.
-            Byte.class,
-            Short.class,
-            Integer.class,
-            Long.class,
-            Float.class,
-            Double.class,
-            Boolean.class,
-            Character.class,
-            String.class,
-
-            // Atomic.
-            AtomicBoolean.class,AtomicInteger.class,
-            AtomicLong.class,AtomicReference.class,
-            AtomicMarkableReference.class,
-            AtomicStampedReference.class,
-            AtomicIntegerArray.class,
-            AtomicReferenceArray.class,
-
-            // Concurrent types.
-            ConcurrentHashMap.class,
-            ConcurrentLinkedQueue.class,
-            ConcurrentSkipListMap.class,
-            ConcurrentSkipListSet.class,
-            LinkedBlockingDeque.class,
-            LinkedBlockingQueue.class,
-            PriorityBlockingQueue.class,
-            CopyOnWriteArrayList.class,
-            CopyOnWriteArraySet.class,
-
-            // Locks.
-            ReentrantLock.class,
-            ReentrantReadWriteLock.class,
-            ReentrantReadWriteLock.ReadLock.class,
-            ReentrantReadWriteLock.WriteLock.class,
-
-            // Util types.
-            Date.class,
-            UUID.class,
-            Calendar.class,
-            Random.class,
-            Calendar.class,
-            Currency.class,
-            ArrayList.class,
-            LinkedList.class,
-            Stack.class,
-            Vector.class,
-            HashMap.class,
-            HashSet.class,
-            Hashtable.class,
-            TreeMap.class,
-            TreeSet.class,
-            IdentityHashMap.class,
-            LinkedHashMap.class,
-            LinkedHashSet.class,
-            ArrayDeque.class,
-            BitSet.class,
-            EnumMap.class,
-            EnumSet.class,
-
-            // SQL types.
-            java.sql.Date.class,
-            Time.class,
-            Timestamp.class,
-
-            // Math types.
-            BigDecimal.class,
-            BigInteger.class,
-
-            // Ignite types.
-            IgniteUuid.class,
-            GridBoundedConcurrentOrderedSet.class,
-            GridBoundedLinkedHashSet.class,
-            GridConcurrentHashSet.class,
-            ConcurrentLinkedDeque8.class,
-            GridConcurrentPhantomHashSet.class,
-            GridConcurrentSkipListSet.class,
-            GridConcurrentWeakHashSet.class,
-            GridIdentityHashSet.class,
-            GridLeanSet.class,
-            GridSetWrapper.class
-        };
-
-        // Have to leave a range for special purposes.
-        assert superOptCls.length < 230;
-
-        ggxId2name = new T2[superOptCls.length];
-
-        for (int i = 0; i < superOptCls.length; i++) {
-            Class cls = superOptCls[i];
-
-            ggxName2id.put(cls.getName(), i);
-            ggxId2name[i] = new T2<Class<?>, OptimizedClassDescriptor>(cls, null);
-        }
-
-        BufferedReader reader = new BufferedReader(new InputStreamReader(
-            OptimizedClassResolver.class.getResourceAsStream(FILE_NAME),
-            OptimizedMarshallerUtils.UTF_8));
-
-        List<T3<String, Class<?>, OptimizedClassDescriptor>> ggId2name0 =
-            new LinkedList<>();
-
-        try {
-            for (int i = 0; ; i++) {
-                String clsName = reader.readLine();
-
-                if (clsName == null)
-                    break;
-
-                ggName2id.put(clsName, i);
-                ggId2name0.add(new T3<String, Class<?>, OptimizedClassDescriptor>(clsName, null, null));
-            }
-
-            ggId2name = ggId2name0.toArray(new T3[ggId2name0.size()]);
-        }
-        catch (IOException e) {
-            throw new AssertionError(e);
-        }
-        finally {
-            U.close(reader, null);
-        }
-    }
-
-    /**
-     * Ensure singleton.
-     */
-    private OptimizedClassResolver() {
-        // No-op.
-    }
-
-    /**
-     * @param usrName2id0 From name to ID.
-     * @param usrId2Name0 From ID to name.
-     */
-    static void userClasses(@Nullable Map<String, Integer> usrName2id0,
-        @Nullable T3<String, Class<?>, OptimizedClassDescriptor>[] usrId2Name0) {
-        usrName2Id = usrName2id0;
-        usrId2Name = usrId2Name0;
-    }
-
-    /**
-     * @param in DataInput to read from.
-     * @param clsLdr ClassLoader.
-     * @return Class descriptor.
-     * @throws IOException If serial version UID failed.
-     * @throws ClassNotFoundException If the class cannot be located by the specified class loader.
-     */
-    static OptimizedClassDescriptor readClass(DataInput in, ClassLoader clsLdr)
-        throws IOException, ClassNotFoundException {
-        assert in != null;
-        assert clsLdr != null;
-
-        int hdr = in.readByte() & 0xff;
-
-        if (hdr < ggxId2name.length) {
-            T2<Class<?>, OptimizedClassDescriptor> ggxT = ggxId2name[hdr];
-
-            OptimizedClassDescriptor desc = ggxT.get2();
-
-            if (desc == null) {
-                desc = OptimizedMarshallerUtils.classDescriptor(ggxT.get1(), null);
-
-                ggxT.set2(desc);
-            }
-
-            return desc;
-        }
-
-        String name;
-        Class<?> cls;
-        OptimizedClassDescriptor desc;
-
-        switch (hdr) {
-            case HEADER_GG_NAME:
-                int ggId = in.readInt();
-
-                T3<String, Class<?>, OptimizedClassDescriptor> ggT;
-
-                try {
-                    ggT = ggId2name[ggId];
-                }
-                catch (ArrayIndexOutOfBoundsException e) {
-                    throw new ClassNotFoundException("Failed to find optimized class ID " +
-                        "(is same Ignite version running on all nodes?): " + ggId, e);
-                }
-
-                name = ggT.get1();
-                cls = ggT.get2();
-                desc = ggT.get3();
-
-                if (desc == null) {
-                    if (clsLdr == U.gridClassLoader()) {
-                        if (cls == null) {
-                            cls = forName(name, clsLdr);
-
-                            ggT.set2(cls);
-                        }
-
-                        desc = OptimizedMarshallerUtils.classDescriptor(cls, null);
-
-                        ggT.set3(desc);
-                    }
-                    else {
-                        cls = forName(name, clsLdr);
-
-                        desc = OptimizedMarshallerUtils.classDescriptor(cls, null);
-                    }
-                }
-
-                break;
-
-            case HEADER_USER_NAME:
-                int usrId = in.readInt();
-
-                T3<String, Class<?>, OptimizedClassDescriptor> usrT;
-
-                try {
-                    if (usrId2Name != null)
-                        usrT = usrId2Name[usrId];
-                    else
-                        throw new ClassNotFoundException("Failed to find user defined class ID " +
-                            "(make sure to register identical classes on all nodes for optimization): " + usrId);
-                }
-                catch (ArrayIndexOutOfBoundsException e) {
-                    throw new ClassNotFoundException("Failed to find user defined class ID " +
-                        "(make sure to register identical classes on all nodes for optimization): " + usrId, e);
-                }
-
-                name = usrT.get1();
-                cls = usrT.get2();
-                desc = usrT.get3();
-
-                if (desc == null) {
-                    if (cls == null) {
-                        cls = forName(name, clsLdr);
-
-                        usrT.set2(cls);
-                    }
-
-                    desc = OptimizedMarshallerUtils.classDescriptor(cls, null);
-
-                    usrT.set3(desc);
-                }
-
-                break;
-
-            case HEADER_ARRAY:
-                name = readClass(in, clsLdr).name();
-
-                name = name.charAt(0) == '[' ? "[" + name : "[L" + name + ';';
-
-                cls = forName(name, clsLdr);
-
-                return OptimizedMarshallerUtils.classDescriptor(cls, null);
-
-            case HEADER_NAME:
-                name = in.readUTF();
-
-                cls = forName(name, clsLdr);
-
-                desc = OptimizedMarshallerUtils.classDescriptor(cls, null);
-
-                break;
-
-            default:
-                throw new IOException("Unexpected optimized stream header: " + hdr);
-        }
-
-        short actual = desc.shortId();
-
-        short exp = in.readShort();
-
-        if (actual != exp)
-            throw new ClassNotFoundException("Optimized stream class checksum mismatch " +
-                "(is same version of marshalled class present on all nodes?) " +
-                "[expected=" + exp + ", actual=" + actual + ", cls=" + cls + ']');
-
-        return desc;
-    }
-
-    /**
-     * @param out Output.
-     * @param desc Class descriptor.
-     * @throws IOException In case of error.
-     */
-    static void writeClass(DataOutput out, OptimizedClassDescriptor desc) throws IOException {
-        assert out != null;
-        assert desc != null;
-
-        int hdr = desc.header();
-
-        out.writeByte(hdr);
-
-        switch (hdr) {
-            case HEADER_GG_NAME:
-            case HEADER_USER_NAME:
-                out.writeInt(desc.id());
-                out.writeShort(desc.shortId());
-
-                return;
-
-            case HEADER_ARRAY:
-                writeClass(out, OptimizedMarshallerUtils.classDescriptor(desc.componentType(), null));
-
-                return;
-
-            case HEADER_NAME:
-                out.writeUTF(desc.name());
-                out.writeShort(desc.shortId());
-        }
-    }
-
-    /**
-     * @param cls Class to write.
-     * @return Data for {@code writeClass} method.
-     */
-    static T2<Integer, Integer> writeClassData(Class<?> cls) {
-        assert cls != null;
-
-        String name = cls.getName();
-
-        Integer superHdr = ggxName2id.get(name);
-
-        if (superHdr != null)
-            return new T2<>(superHdr, null);
-
-        Integer id;
-
-        if ((id = ggName2id.get(name)) != null)
-            return new T2<>(HEADER_GG_NAME, id);
-
-        if (usrName2Id != null && (id = usrName2Id.get(name)) != null)
-            return new T2<>(HEADER_USER_NAME, id);
-
-        if (cls.isArray())
-            return new T2<>(HEADER_ARRAY, null);
-
-        return new T2<>(HEADER_NAME, null);
-    }
-
-    /**
-     * @param name Class name.
-     * @param ldr Class loader.
-     * @return Class.
-     * @throws ClassNotFoundException If class not found.
-     */
-    private static Class<?> forName(String name, ClassLoader ldr) throws ClassNotFoundException {
-        Class<?> cls = primitive(name);
-
-        if (cls == null)
-            cls = OptimizedMarshallerUtils.forName(name, ldr);
-
-        return cls;
-    }
-
-    /**
-     * @param name Name of primitive class.
-     * @return Primitive type class or null.
-     */
-    @SuppressWarnings("TypeMayBeWeakened")
-    @Nullable private static Class<?> primitive(String name) {
-        if (name.length() > 7)
-            return null;
-
-        switch (name.charAt(0)) {
-            case 'b':
-                if ("boolean".equals(name))
-                    return boolean.class;
-
-                return "byte".equals(name) ? byte.class : null;
-            case 's':
-                return "short".equals(name) ? short.class : null;
-            case 'i':
-                return "int".equals(name) ? int.class : null;
-            case 'l':
-                return "long".equals(name) ? long.class : null;
-            case 'c':
-                return "char".equals(name) ? char.class : null;
-            case 'f':
-                return "float".equals(name) ? float.class : null;
-            case 'd':
-                return "double".equals(name) ? double.class : null;
-            case 'v':
-                return "void".equals(name) ? void.class : null;
-        }
-
-        return null;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6d85e75d/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedMarshallable.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedMarshallable.java b/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedMarshallable.java
deleted file mode 100644
index 729b062..0000000
--- a/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedMarshallable.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.marshaller.optimized;
-
-import java.util.*;
-
-/**
- * Optional interface which helps make serialization even faster by removing internal
- * look-ups for classes.
- * <p>
- * All implementation must have the following:
- * <ul>
- * <li>
- *     Must have static filed (private or public) declared of type {@link Object}
- *     with name {@code GG_CLASS_ID}. Ignite will reflectively initialize this field with
- *     proper class ID during system startup.
- * </li>
- * <li>
- *     Must return the value of {@code GG_CLASS_ID} field from {@link #ggClassId} method.
- * </li>
- * </ul>
- * Here is a sample implementation:
- * <pre name="code" class="java">
- * // For better performance consider implementing java.io.Externalizable interface.
- * class ExampleMarshallable implements GridOptimizedMarshallable, Serializable {
- *     // Class ID field required by 'GridOptimizedMarshallable'.
- *     private static Object GG_CLASS_ID;
- *
- *     ...
- *
- *     &#64; public Object ggClassId() {
- *         return GG_CLASS_ID;
- *     }
- * }
- * </pre>
- * <p>
- * Note that for better performance you should also specify list of classes you
- * plan to serialize via {@link OptimizedMarshaller#setClassNames(List)} method.
- */
-public interface OptimizedMarshallable {
-    /** */
-    public static final String CLS_ID_FIELD_NAME = "GG_CLASS_ID";
-
-    /**
-     * Implementation of this method should simply return value of {@code GG_CLASS_ID} field.
-     *
-     * @return Class ID for optimized marshalling.
-     */
-    public Object ggClassId();
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6d85e75d/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedMarshaller.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedMarshaller.java b/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedMarshaller.java
index 57d0506..1e7f802 100644
--- a/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedMarshaller.java
+++ b/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedMarshaller.java
@@ -19,15 +19,11 @@ package org.apache.ignite.marshaller.optimized;
 
 import org.apache.ignite.*;
 import org.apache.ignite.internal.util.*;
-import org.apache.ignite.internal.util.typedef.*;
-import org.apache.ignite.internal.util.typedef.internal.*;
 import org.apache.ignite.marshaller.*;
 import org.jetbrains.annotations.*;
 import sun.misc.*;
 
 import java.io.*;
-import java.net.*;
-import java.util.*;
 
 /**
  * Optimized implementation of {@link org.apache.ignite.marshaller.Marshaller}. Unlike {@link org.apache.ignite.marshaller.jdk.JdkMarshaller},
@@ -77,14 +73,14 @@ import java.util.*;
  * For information about Spring framework visit <a href="http://www.springframework.org/">www.springframework.org</a>
  */
 public class OptimizedMarshaller extends AbstractMarshaller {
-    /** Whether or not to require an object to be serializable in order to be marshalled. */
-    private boolean requireSer = true;
-
     /** Default class loader. */
     private final ClassLoader dfltClsLdr = getClass().getClassLoader();
 
+    /** Whether or not to require an object to be serializable in order to be marshalled. */
+    private boolean requireSer = true;
+
     /**
-     * Initializes marshaller not to enforce {@link Serializable} interface.
+     * Creates new marshaller will all defaults.
      *
      * @throws IgniteException If this marshaller is not supported on the current JVM.
      */
@@ -95,116 +91,22 @@ public class OptimizedMarshaller extends AbstractMarshaller {
     }
 
     /**
-     * Initializes marshaller with given serialization flag. If {@code true},
-     * then objects will be required to implement {@link Serializable} in order
-     * to be serialize.
+     * Creates new marshaller providing whether it should
+     * require {@link Serializable} interface or not.
      *
-     * @param requireSer Flag to enforce {@link Serializable} interface or not. If {@code true},
-     *      then objects will be required to implement {@link Serializable} in order to be
-     *      marshalled, if {@code false}, then such requirement will be relaxed.
-     * @throws IgniteException If this marshaller is not supported on the current JVM.
+     * @param requireSer Whether to require {@link Serializable}.
      */
     public OptimizedMarshaller(boolean requireSer) {
-        this();
-
         this.requireSer = requireSer;
     }
 
     /**
-     * Initializes marshaller with given serialization flag. If {@code true},
-     * then objects will be required to implement {@link Serializable} in order
-     * to be serialize.
+     * Sets whether marshaller should require {@link Serializable} interface or not.
      *
-     * @param requireSer Flag to enforce {@link Serializable} interface or not. If {@code true},
-     *      then objects will be required to implement {@link Serializable} in order to be
-     *      marshalled, if {@code false}, then such requirement will be relaxed.
-     * @param clsNames User preregistered class names.
-     * @param clsNamesPath Path to a file with user preregistered class names.
-     * @param poolSize Object streams pool size.
-     * @throws IgniteCheckedException If an I/O error occurs while writing stream header.
-     * @throws IgniteException If this marshaller is not supported on the current JVM.
+     * @param requireSer Whether to require {@link Serializable}.
      */
-    public OptimizedMarshaller(boolean requireSer, @Nullable List<String> clsNames,
-        @Nullable String clsNamesPath, int poolSize) throws IgniteCheckedException {
-        this(requireSer);
-
-        setClassNames(clsNames);
-        setClassNamesPath(clsNamesPath);
-        setPoolSize(poolSize);
-    }
-
-    /**
-     * Adds provided class names for marshalling optimization.
-     * <p>
-     * <b>NOTE</b>: these collections of classes must be identical on all nodes and in the same order.
-     *
-     * @param clsNames User preregistered class names to add.
-     */
-    @SuppressWarnings("unchecked")
-    public void setClassNames(@Nullable List<String> clsNames) {
-        if (clsNames != null && !clsNames.isEmpty()) {
-            String[] clsNamesArr = clsNames.toArray(new String[clsNames.size()]);
-
-            Arrays.sort(clsNamesArr);
-
-            Map<String, Integer> name2id = U.newHashMap(clsNamesArr.length);
-            T3<String, Class<?>, OptimizedClassDescriptor>[] id2name = new T3[clsNamesArr.length];
-
-            int i = 0;
-
-            for (String name : clsNamesArr) {
-                name2id.put(name, i);
-                id2name[i++] = new T3<>(name, null, null);
-            }
-
-            OptimizedClassResolver.userClasses(name2id, id2name);
-        }
-    }
-
-    /**
-     * Specifies a name of the file which lists all class names to be optimized.
-     * The file path can either be absolute path, relative to {@code IGNITE_HOME},
-     * or specify a resource file on the class path.
-     * <p>
-     * The format of the file is class name per line, like this:
-     * <pre>
-     * ...
-     * com.example.Class1
-     * com.example.Class2
-     * ...
-     * </pre>
-     * <p>
-     * <b>NOTE</b>: this class list must be identical on all nodes and in the same order.
-     *
-     * @param path Path to a file with user preregistered class names.
-     * @throws IgniteCheckedException If an error occurs while writing stream header.
-     */
-    public void setClassNamesPath(@Nullable String path) throws IgniteCheckedException {
-        if (path == null)
-            return;
-
-        URL url = IgniteUtils.resolveIgniteUrl(path, false);
-
-        if (url == null)
-            throw new IgniteCheckedException("Failed to find resource for name: " + path);
-
-        List<String> clsNames;
-
-        try {
-            clsNames = new LinkedList<>();
-
-            try (BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream(), OptimizedMarshallerUtils.UTF_8))) {
-                String clsName;
-
-                while ((clsName = reader.readLine()) != null)
-                    clsNames.add(clsName);
-            }
-        }
-        catch (IOException e) {
-            throw new IgniteCheckedException("Failed to read class names from path: " + path, e);
-        }
-
-        setClassNames(clsNames);
+    public void setRequireSerializable(boolean requireSer) {
+        this.requireSer = requireSer;
     }
 
     /**
@@ -226,24 +128,6 @@ public class OptimizedMarshaller extends AbstractMarshaller {
         OptimizedObjectStreamRegistry.poolSize(poolSize);
     }
 
-    /**
-     * @return Whether to enforce {@link Serializable} interface.
-     */
-    public boolean isRequireSerializable() {
-        return requireSer;
-    }
-
-    /**
-     * Sets flag to enforce {@link Serializable} interface or not.
-     *
-     * @param requireSer Flag to enforce {@link Serializable} interface or not. If {@code true},
-     *      then objects will be required to implement {@link Serializable} in order to be
-     *      marshalled, if {@code false}, then such requirement will be relaxed.
-     */
-    public void setRequireSerializable(boolean requireSer) {
-        this.requireSer = requireSer;
-    }
-
     /** {@inheritDoc} */
     @Override public void marshal(@Nullable Object obj, OutputStream out) throws IgniteCheckedException {
         assert out != null;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6d85e75d/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedMarshallerUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedMarshallerUtils.java b/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedMarshallerUtils.java
index 6d8ebfc..7bc606a 100644
--- a/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedMarshallerUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedMarshallerUtils.java
@@ -20,7 +20,6 @@ package org.apache.ignite.marshaller.optimized;
 import org.apache.ignite.internal.util.*;
 import org.apache.ignite.internal.util.typedef.*;
 import org.jdk8.backport.*;
-import org.jetbrains.annotations.*;
 import sun.misc.*;
 
 import java.io.*;
@@ -30,8 +29,6 @@ import java.security.*;
 import java.util.*;
 import java.util.concurrent.*;
 
-import static org.apache.ignite.marshaller.optimized.OptimizedMarshallable.*;
-
 /**
  * Miscellaneous utility methods to facilitate {@link OptimizedMarshaller}.
  */
@@ -51,129 +48,65 @@ class OptimizedMarshallerUtils {
     /** UTF-8 character name. */
     static final Charset UTF_8 = Charset.forName("UTF-8");
 
-    /** Class descriptors cache. */
-    private static final ConcurrentMap<Class<?>, OptimizedClassDescriptor> CLS_DESC_CACHE =
+    /** Class descriptors by class. */
+    private static final ConcurrentMap<Class<?>, OptimizedClassDescriptor> DESC_BY_CLS =
         new ConcurrentHashMap8<>(256);
 
-    /** Classes cache by name. */
-    private static final ConcurrentHashMap8<ClassLoader, ConcurrentHashMap8<String, Class<?>>> CLS_BY_NAME_CACHE =
-        new ConcurrentHashMap8<>();
+    /** Class descriptors by ID. */
+    private static final ConcurrentMap<Integer, OptimizedClassDescriptor> DESC_BY_ID =
+        new ConcurrentHashMap8<>(256);
 
     /**
-     * Suppresses default constructor, ensuring non-instantiability.
      */
     private OptimizedMarshallerUtils() {
         // No-op.
     }
 
     /**
-     * Gets class for given name and class loader.
+     * Gets descriptor for provided class.
      *
-     * @param name Class name.
-     * @param ldr Class loader.
-     * @return Class.
-     * @throws ClassNotFoundException If class was not found.
+     * @param cls Class.
+     * @return Descriptor.
+     * @throws IOException In case of error.
      */
-    static Class<?> forName(String name, ClassLoader ldr) throws ClassNotFoundException {
-        assert ldr != null;
-        assert name != null;
-
-        ConcurrentHashMap8<String, Class<?>> cache = CLS_BY_NAME_CACHE.get(ldr);
+    static OptimizedClassDescriptor classDescriptor(Class<?> cls) throws IOException {
+        OptimizedClassDescriptor desc = DESC_BY_CLS.get(cls);
 
-        Class<?> cls = null;
-
-        if (cache == null) {
-            cache = new ConcurrentHashMap8<>();
-
-            ConcurrentHashMap8<String, Class<?>> old = CLS_BY_NAME_CACHE.putIfAbsent(ldr, cache);
-
-            if (old != null) {
-                cache = old;
-
-                cls = cache.get(name);
-            }
-        }
-        else
-            cls = cache.get(name);
+        if (desc == null) {
+            // TODO: IGNITE-141 - Put to cache.
 
-        if (cls == null) {
-            cls = Class.forName(name, true, ldr);
+            OptimizedClassDescriptor old = DESC_BY_CLS.putIfAbsent(cls, desc = new OptimizedClassDescriptor(cls));
 
-            cache.put(name, cls);
+            if (old != null)
+                desc = old;
         }
 
-        return cls;
+        return desc;
     }
 
     /**
-     * Gets descriptor for provided class.
+     * Gets descriptor for provided ID.
      *
-     * @param cls Class.
-     * @param obj Object.
+     * @param id ID.
+     * @param ldr Class loader.
      * @return Descriptor.
      * @throws IOException In case of error.
+     * @throws ClassNotFoundException If class was not found.
      */
-    static OptimizedClassDescriptor classDescriptor(Class<?> cls, @Nullable Object obj) throws IOException {
-        if (obj != null) {
-            if (obj instanceof OptimizedMarshallable) {
-                OptimizedMarshallable m = (OptimizedMarshallable)obj;
-
-                Object clsId = m.ggClassId();
-
-                if (clsId != null && !(clsId instanceof OptimizedClassDescriptor))
-                    throw new IOException("Method '" + obj.getClass().getName() + ".ggClassId() must return " +
-                        "the value of the field '" + CLS_ID_FIELD_NAME + "'.");
-
-                OptimizedClassDescriptor desc = (OptimizedClassDescriptor)clsId;
-
-                if (desc == null) {
-                    desc = new OptimizedClassDescriptor(cls);
-
-                    try {
-                        Field field = obj.getClass().getDeclaredField(CLS_ID_FIELD_NAME);
-
-                        field.setAccessible(true);
-
-                        Object o = field.get(null);
-
-                        if (o == null) {
-                            if ((field.getModifiers() & Modifier.STATIC) == 0)
-                                throw new IOException("Field '" + CLS_ID_FIELD_NAME + "' must be declared static: " +
-                                    obj.getClass().getName());
-
-                            field.set(null, desc);
-
-                            if (m.ggClassId() == null)
-                                throw new IOException( "Method '" + obj.getClass().getName() + ".ggClassId() must " +
-                                    "return the value of the field '" + CLS_ID_FIELD_NAME + "': "
-                                    + obj.getClass().getName());
-                        }
-                        else if (!(o instanceof OptimizedClassDescriptor))
-                            throw new IOException("Field '" + CLS_ID_FIELD_NAME + "' must be declared with " +
-                                "null value: " + obj.getClass().getName());
-                    }
-                    catch (NoSuchFieldException e) {
-                        throw new IOException("GridOptimizedMarshallable classes must have static field declared " +
-                            "[fieldName=" + CLS_ID_FIELD_NAME + ", cls=" + obj.getClass().getName() + ']', e);
-                    }
-                    catch (IllegalAccessException e) {
-                        throw new IOException("Failed to set field '" + CLS_ID_FIELD_NAME + "' on '" +
-                            obj.getClass().getName() + "' class.", e);
-                    }
-                }
-
-                return desc;
-            }
-        }
-
-        OptimizedClassDescriptor desc = CLS_DESC_CACHE.get(cls);
+    static OptimizedClassDescriptor classDescriptor(int id, ClassLoader ldr)
+        throws IOException, ClassNotFoundException {
+        OptimizedClassDescriptor desc = DESC_BY_ID.get(id);
 
         if (desc == null) {
-            OptimizedClassDescriptor existing = CLS_DESC_CACHE.putIfAbsent(cls,
-                desc = new OptimizedClassDescriptor(cls));
+            // TODO: IGNITE-141 - Get from cache.
+            String clsName = null;
+
+            Class<?> cls = Class.forName(clsName, true, ldr);
 
-            if (existing != null)
-                desc = existing;
+            OptimizedClassDescriptor old = DESC_BY_ID.putIfAbsent(id, desc = new OptimizedClassDescriptor(cls));
+
+            if (old != null)
+                desc = old;
         }
 
         return desc;
@@ -185,11 +118,9 @@ class OptimizedMarshallerUtils {
      * @param ldr Undeployed class loader.
      */
     public static void onUndeploy(ClassLoader ldr) {
-        CLS_BY_NAME_CACHE.remove(ldr);
-
-        for (Class<?> cls : CLS_DESC_CACHE.keySet()) {
+        for (Class<?> cls : DESC_BY_CLS.keySet()) {
             if (ldr.equals(cls.getClassLoader()))
-                CLS_DESC_CACHE.remove(cls);
+                DESC_BY_CLS.remove(cls);
         }
     }
 
@@ -197,20 +128,8 @@ class OptimizedMarshallerUtils {
      * Intended for test purposes only.
      */
     public static void clearCache() {
-        CLS_BY_NAME_CACHE.clear();
-        CLS_DESC_CACHE.clear();
-    }
-
-    /**
-     *
-     */
-    public static void printMemoryStats() {
-        X.println(">>>");
-        X.println(">>> GridOptimizedMarshallerUtils memory stats:");
-        X.println(" Cache size: " + CLS_DESC_CACHE.size());
-
-        for (Map.Entry<Class<?>, OptimizedClassDescriptor> e : CLS_DESC_CACHE.entrySet())
-            X.println(" " + e.getKey() + " : " + e.getValue());
+        DESC_BY_CLS.clear();
+        DESC_BY_ID.clear();
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6d85e75d/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedObjectInputStream.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedObjectInputStream.java b/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedObjectInputStream.java
index ef589e9..6b07e08 100644
--- a/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedObjectInputStream.java
+++ b/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedObjectInputStream.java
@@ -143,7 +143,9 @@ class OptimizedObjectInputStream extends ObjectInputStream {
                 return handles.lookup(readInt());
 
             case OBJECT:
-                OptimizedClassDescriptor desc = OptimizedClassResolver.readClass(this, clsLdr);
+                int clsId = readInt();
+
+                OptimizedClassDescriptor desc = OptimizedMarshallerUtils.classDescriptor(clsId, clsLdr);
 
                 curCls = desc.describedClass();
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6d85e75d/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedObjectOutputStream.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedObjectOutputStream.java b/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedObjectOutputStream.java
index ff1f043..507dde6 100644
--- a/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedObjectOutputStream.java
+++ b/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedObjectOutputStream.java
@@ -156,7 +156,7 @@ class OptimizedObjectOutputStream extends ObjectOutputStream {
         else {
             Class<?> cls = obj.getClass();
 
-            OptimizedClassDescriptor desc = classDescriptor(cls, obj);
+            OptimizedClassDescriptor desc = classDescriptor(cls);
 
             if (desc.excluded()) {
                 writeByte(NULL);
@@ -180,7 +180,7 @@ class OptimizedObjectOutputStream extends ObjectOutputStream {
             if (obj0 != obj) {
                 obj = obj0;
 
-                desc = classDescriptor(obj.getClass(), obj);
+                desc = classDescriptor(obj.getClass());
             }
 
             if (handle >= 0) {
@@ -190,8 +190,6 @@ class OptimizedObjectOutputStream extends ObjectOutputStream {
             else {
                 writeByte(OBJECT);
 
-                OptimizedClassResolver.writeClass(this, desc);
-
                 desc.write(this, obj);
             }
         }
@@ -762,7 +760,6 @@ class OptimizedObjectOutputStream extends ObjectOutputStream {
 
         /**
          * @param out Output stream.
-         * @throws IOException In case of error.
          */
         @SuppressWarnings("unchecked")
         private PutFieldImpl(OptimizedObjectOutputStream out) {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6d85e75d/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/optimized-classnames.previous.properties
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/optimized-classnames.previous.properties b/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/optimized-classnames.previous.properties
deleted file mode 100644
index e69de29..0000000


Mime
View raw message