ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yzhda...@apache.org
Subject [05/51] [abbrv] incubator-ignite git commit: sprint-1 - marshaller renaming.
Date Sat, 07 Feb 2015 10:52:37 GMT
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5674cdde/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
new file mode 100644
index 0000000..f7e5618
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedObjectInputStream.java
@@ -0,0 +1,1016 @@
+/*
+ * 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.io.*;
+import org.apache.ignite.internal.util.typedef.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
+import org.apache.ignite.lang.*;
+import sun.misc.*;
+
+import java.io.*;
+import java.lang.reflect.*;
+import java.util.*;
+
+import static org.apache.ignite.marshaller.optimized.OptimizedMarshallerUtils.*;
+
+/**
+ * Optimized object input stream.
+ */
+class OptimizedObjectInputStream extends ObjectInputStream {
+    /** Unsafe. */
+    private static final Unsafe UNSAFE = GridUnsafe.unsafe();
+
+    /** Dummy object for HashSet. */
+    private static final Object DUMMY = new Object();
+
+    /** */
+    private final HandleTable handles = new HandleTable(10);
+
+    /** */
+    private ClassLoader clsLdr;
+
+    /** */
+    private GridDataInput in;
+
+    /** */
+    private Object curObj;
+
+    /** */
+    private List<T2<OptimizedFieldType, Long>> curFields;
+
+    /** */
+    private List<IgniteBiTuple<Integer, OptimizedFieldType>> curFieldInfoList;
+
+    /** */
+    private Map<String, IgniteBiTuple<Integer, OptimizedFieldType>> curFieldInfoMap;
+
+    /** */
+    private Class<?> curCls;
+
+    /**
+     * @param in Input.
+     * @throws IOException In case of error.
+     */
+    OptimizedObjectInputStream(GridDataInput in) throws IOException {
+        this.in = in;
+    }
+
+    /**
+     * @throws IOException In case of error.
+     */
+    OptimizedObjectInputStream() throws IOException {
+        // No-op.
+    }
+
+    /**
+     * @param clsLdr Class loader.
+     */
+    void classLoader(ClassLoader clsLdr) {
+        this.clsLdr = clsLdr;
+    }
+
+    /**
+     * @return Class loader.
+     */
+    ClassLoader classLoader() {
+        return clsLdr;
+    }
+
+    /**
+     * @return Input.
+     */
+    public GridDataInput in() {
+        return in;
+    }
+
+    /**
+     * @param in Input.
+     */
+    public void in(GridDataInput in) {
+        this.in = in;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void close() throws IOException {
+        reset();
+    }
+
+    /** {@inheritDoc} */
+    @SuppressWarnings("NonSynchronizedMethodOverridesSynchronizedMethod")
+    @Override public void reset() throws IOException {
+        in.reset();
+        handles.clear();
+
+        curObj = null;
+        curFields = null;
+        curFieldInfoList = null;
+        curFieldInfoMap = null;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Object readObjectOverride() throws ClassNotFoundException, IOException {
+        curObj = null;
+        curFields = null;
+        curFieldInfoList = null;
+        curFieldInfoMap = null;
+
+        byte ref = in.readByte();
+
+        switch (ref) {
+            case NULL:
+                return null;
+
+            case HANDLE:
+                return handles.lookup(readInt());
+
+            case OBJECT:
+                OptimizedClassDescriptor desc = OptimizedClassResolver.readClass(this, clsLdr);
+
+                curCls = desc.describedClass();
+
+                return desc.read(this);
+
+            default:
+                SB msg = new SB("Unexpected error occurred during unmarshalling");
+
+                if (curCls != null)
+                    msg.a(" of an instance of the class: ").a(curCls.getName());
+
+                msg.a(". Check that all nodes are running the same version of GridGain and that all nodes have " +
+                    "GridOptimizedMarshaller configured with identical optimized classes lists, if any " +
+                    "(see setClassNames and setClassNamesPath methods). If your serialized classes implement " +
+                    "java.io.Externalizable interface, verify that serialization logic is correct.");
+
+                throw new IOException(msg.toString());
+        }
+    }
+
+    /**
+     * Reads array from this stream.
+     *
+     * @param compType Array component type.
+     * @return Array.
+     * @throws ClassNotFoundException If class not found.
+     * @throws IOException In case of error.
+     */
+    <T> T[] readArray(Class<T> compType) throws ClassNotFoundException, IOException {
+        int len = in.readInt();
+
+        T[] arr = (T[])Array.newInstance(compType, len);
+
+        handles.assign(arr);
+
+        for (int i = 0; i < len; i++)
+            arr[i] = (T)readObject();
+
+        return arr;
+    }
+
+    /**
+     * Reads {@link UUID} from this stream.
+     *
+     * @return UUID.
+     * @throws IOException In case of error.
+     */
+    UUID readUuid() throws IOException {
+        UUID uuid = new UUID(readLong(), readLong());
+
+        handles.assign(uuid);
+
+        return uuid;
+    }
+
+    /**
+     * Reads {@link Properties} from this stream.
+     *
+     * @return Properties.
+     * @throws ClassNotFoundException If class not found.
+     * @throws IOException In case of error.
+     */
+    Properties readProperties() throws ClassNotFoundException, IOException {
+        Properties dflts = readBoolean() ? null : (Properties)readObject();
+
+        Properties props = new Properties(dflts);
+
+        int size = in.readInt();
+
+        for (int i = 0; i < size; i++)
+            props.setProperty(readUTF(), readUTF());
+
+        handles.assign(props);
+
+        return props;
+    }
+
+    /**
+     * Reads and sets all non-static and non-transient field values from this stream.
+     *
+     * @param obj Object.
+     * @param fieldOffs Field offsets.
+     * @throws ClassNotFoundException If class not found.
+     * @throws IOException In case of error.
+     */
+    @SuppressWarnings("ForLoopReplaceableByForEach")
+    void readFields(Object obj, List<T2<OptimizedFieldType, Long>> fieldOffs) throws ClassNotFoundException,
+        IOException {
+        for (int i = 0; i < fieldOffs.size(); i++) {
+            T2<OptimizedFieldType, Long> t = fieldOffs.get(i);
+
+            switch ((t.get1())) {
+                case BYTE:
+                    setByte(obj, t.get2(), readByte());
+
+                    break;
+
+                case SHORT:
+                    setShort(obj, t.get2(), readShort());
+
+                    break;
+
+                case INT:
+                    setInt(obj, t.get2(), readInt());
+
+                    break;
+
+                case LONG:
+                    setLong(obj, t.get2(), readLong());
+
+                    break;
+
+                case FLOAT:
+                    setFloat(obj, t.get2(), readFloat());
+
+                    break;
+
+                case DOUBLE:
+                    setDouble(obj, t.get2(), readDouble());
+
+                    break;
+
+                case CHAR:
+                    setChar(obj, t.get2(), readChar());
+
+                    break;
+
+                case BOOLEAN:
+                    setBoolean(obj, t.get2(), readBoolean());
+
+                    break;
+
+                case OTHER:
+                    setObject(obj, t.get2(), readObject());
+            }
+        }
+    }
+
+    /**
+     * Reads {@link Externalizable} object.
+     *
+     * @param constructor Constructor.
+     * @param readResolveMtd {@code readResolve} method.
+     * @return Object.
+     * @throws ClassNotFoundException If class not found.
+     * @throws IOException In case of error.
+     */
+    Object readExternalizable(Constructor<?> constructor, Method readResolveMtd)
+        throws ClassNotFoundException, IOException {
+        Object obj;
+
+        try {
+            obj = constructor.newInstance();
+        }
+        catch (InstantiationException | InvocationTargetException | IllegalAccessException e) {
+            throw new IOException(e);
+        }
+
+        int handle = handles.assign(obj);
+
+        Externalizable extObj = ((Externalizable)obj);
+
+        extObj.readExternal(this);
+
+        if (readResolveMtd != null) {
+            try {
+                obj = readResolveMtd.invoke(obj);
+
+                handles.set(handle, obj);
+            }
+            catch (IllegalAccessException | InvocationTargetException e) {
+                throw new IOException(e);
+            }
+        }
+
+        return obj;
+    }
+
+    /**
+     * Reads serializable object.
+     *
+     * @param cls Class.
+     * @param mtds {@code readObject} methods.
+     * @param readResolveMtd {@code readResolve} method.
+     * @param fields class fields details.
+     * @return Object.
+     * @throws ClassNotFoundException If class not found.
+     * @throws IOException In case of error.
+     */
+    @SuppressWarnings("ForLoopReplaceableByForEach")
+    Object readSerializable(Class<?> cls, List<Method> mtds, Method readResolveMtd,
+        OptimizedClassDescriptor.Fields fields) throws ClassNotFoundException, IOException {
+        Object obj;
+
+        try {
+            obj = UNSAFE.allocateInstance(cls);
+        }
+        catch (InstantiationException e) {
+            throw new IOException(e);
+        }
+
+        int handle = handles.assign(obj);
+
+        for (int i = 0; i < mtds.size(); i++) {
+            Method mtd = mtds.get(i);
+
+            if (mtd != null) {
+                curObj = obj;
+                curFields = fields.fieldOffs(i);
+                curFieldInfoList = fields.fieldInfoList(i);
+                curFieldInfoMap = fields.fieldInfoMap(i);
+
+                try {
+                    mtd.invoke(obj, this);
+                }
+                catch (IllegalAccessException | InvocationTargetException e) {
+                    throw new IOException(e);
+                }
+            }
+            else
+                readFields(obj, fields.fieldOffs(i));
+        }
+
+        if (readResolveMtd != null) {
+            try {
+                obj = readResolveMtd.invoke(obj);
+
+                handles.set(handle, obj);
+            }
+            catch (IllegalAccessException | InvocationTargetException e) {
+                throw new IOException(e);
+            }
+        }
+
+        return obj;
+    }
+
+    /**
+     * Reads {@link ArrayList}.
+     *
+     * @return List.
+     * @throws ClassNotFoundException If class not found.
+     * @throws IOException In case of error.
+     */
+    ArrayList<?> readArrayList() throws ClassNotFoundException, IOException {
+        int size = readInt();
+
+        ArrayList<Object> list = new ArrayList<>(size);
+
+        handles.assign(list);
+
+        for (int i = 0; i < size; i++)
+            list.add(readObject());
+
+        return list;
+    }
+
+    /**
+     * Reads {@link HashMap}.
+     *
+     * @param set Whether reading underlying map from {@link HashSet}.
+     * @return Map.
+     * @throws ClassNotFoundException If class not found.
+     * @throws IOException In case of error.
+     */
+    HashMap<?, ?> readHashMap(boolean set) throws ClassNotFoundException, IOException {
+        int size = readInt();
+        float loadFactor = readFloat();
+
+        HashMap<Object, Object> map = new HashMap<>(size, loadFactor);
+
+        if (!set)
+            handles.assign(map);
+
+        for (int i = 0; i < size; i++) {
+            Object key = readObject();
+            Object val = !set ? readObject() : DUMMY;
+
+            map.put(key, val);
+        }
+
+        return map;
+    }
+
+    /**
+     * Reads {@link HashSet}.
+     *
+     * @param mapFieldOff Map field offset.
+     * @return Set.
+     * @throws ClassNotFoundException If class not found.
+     * @throws IOException In case of error.
+     */
+    HashSet<?> readHashSet(long mapFieldOff) throws ClassNotFoundException, IOException {
+        try {
+            HashSet<Object> set = (HashSet<Object>)UNSAFE.allocateInstance(HashSet.class);
+
+            handles.assign(set);
+
+            setObject(set, mapFieldOff, readHashMap(true));
+
+            return set;
+        }
+        catch (InstantiationException e) {
+            throw new IOException(e);
+        }
+    }
+
+    /**
+     * Reads {@link LinkedList}.
+     *
+     * @return List.
+     * @throws ClassNotFoundException If class not found.
+     * @throws IOException In case of error.
+     */
+    LinkedList<?> readLinkedList() throws ClassNotFoundException, IOException {
+        int size = readInt();
+
+        LinkedList<Object> list = new LinkedList<>();
+
+        handles.assign(list);
+
+        for (int i = 0; i < size; i++)
+            list.add(readObject());
+
+        return list;
+    }
+
+    /**
+     * Reads {@link LinkedHashMap}.
+     *
+     * @param set Whether reading underlying map from {@link LinkedHashSet}.
+     * @return Map.
+     * @throws ClassNotFoundException If class not found.
+     * @throws IOException In case of error.
+     */
+    LinkedHashMap<?, ?> readLinkedHashMap(boolean set) throws ClassNotFoundException, IOException {
+        int size = readInt();
+        float loadFactor = readFloat();
+        boolean accessOrder = readBoolean();
+
+        LinkedHashMap<Object, Object> map = new LinkedHashMap<>(size, loadFactor, accessOrder);
+
+        if (!set)
+            handles.assign(map);
+
+        for (int i = 0; i < size; i++) {
+            Object key = readObject();
+            Object val = !set ? readObject() : DUMMY;
+
+            map.put(key, val);
+        }
+
+        return map;
+    }
+
+    /**
+     * Reads {@link LinkedHashSet}.
+     *
+     * @param mapFieldOff Map field offset.
+     * @return Set.
+     * @throws ClassNotFoundException If class not found.
+     * @throws IOException In case of error.
+     */
+    LinkedHashSet<?> readLinkedHashSet(long mapFieldOff) throws ClassNotFoundException, IOException {
+        try {
+            LinkedHashSet<Object> set = (LinkedHashSet<Object>)UNSAFE.allocateInstance(LinkedHashSet.class);
+
+            handles.assign(set);
+
+            setObject(set, mapFieldOff, readLinkedHashMap(true));
+
+            return set;
+        }
+        catch (InstantiationException e) {
+            throw new IOException(e);
+        }
+    }
+
+    /**
+     * Reads {@link Date}.
+     *
+     * @return Date.
+     * @throws ClassNotFoundException If class not found.
+     * @throws IOException In case of error.
+     */
+    Date readDate() throws ClassNotFoundException, IOException {
+        Date date = new Date(readLong());
+
+        handles.assign(date);
+
+        return date;
+    }
+
+    /**
+     * Reads array of {@code byte}s.
+     *
+     * @return Array.
+     * @throws IOException In case of error.
+     */
+    byte[] readByteArray() throws IOException {
+        byte[] arr = in.readByteArray();
+
+        handles.assign(arr);
+
+        return arr;
+    }
+
+    /**
+     * Reads array of {@code short}s.
+     *
+     * @return Array.
+     * @throws IOException In case of error.
+     */
+    short[] readShortArray() throws IOException {
+        short[] arr = in.readShortArray();
+
+        handles.assign(arr);
+
+        return arr;
+    }
+
+    /**
+     * Reads array of {@code int}s.
+     *
+     * @return Array.
+     * @throws IOException In case of error.
+     */
+    int[] readIntArray() throws IOException {
+        int[] arr = in.readIntArray();
+
+        handles.assign(arr);
+
+        return arr;
+    }
+
+    /**
+     * Reads array of {@code long}s.
+     *
+     * @return Array.
+     * @throws IOException In case of error.
+     */
+    long[] readLongArray() throws IOException {
+        long[] arr = in.readLongArray();
+
+        handles.assign(arr);
+
+        return arr;
+    }
+
+    /**
+     * Reads array of {@code float}s.
+     *
+     * @return Array.
+     * @throws IOException In case of error.
+     */
+    float[] readFloatArray() throws IOException {
+        float[] arr = in.readFloatArray();
+
+        handles.assign(arr);
+
+        return arr;
+    }
+
+    /**
+     * Reads array of {@code double}s.
+     *
+     * @return Array.
+     * @throws IOException In case of error.
+     */
+    double[] readDoubleArray() throws IOException {
+        double[] arr = in.readDoubleArray();
+
+        handles.assign(arr);
+
+        return arr;
+    }
+
+    /**
+     * Reads array of {@code char}s.
+     *
+     * @return Array.
+     * @throws IOException In case of error.
+     */
+    char[] readCharArray() throws IOException {
+        char[] arr = in.readCharArray();
+
+        handles.assign(arr);
+
+        return arr;
+    }
+
+    /**
+     * Reads array of {@code boolean}s.
+     *
+     * @return Array.
+     * @throws IOException In case of error.
+     */
+    boolean[] readBooleanArray() throws IOException {
+        boolean[] arr = in.readBooleanArray();
+
+        handles.assign(arr);
+
+        return arr;
+    }
+
+    /**
+     * Reads {@link String}.
+     *
+     * @return String.
+     * @throws IOException In case of error.
+     */
+    public String readString() throws IOException {
+        String str = in.readUTF();
+
+        handles.assign(str);
+
+        return str;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void readFully(byte[] b) throws IOException {
+        in.readFully(b);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void readFully(byte[] b, int off, int len) throws IOException {
+        in.readFully(b, off, len);
+    }
+
+    /** {@inheritDoc} */
+    @Override public int skipBytes(int n) throws IOException {
+        return in.skipBytes(n);
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean readBoolean() throws IOException {
+        return in.readBoolean();
+    }
+
+    /** {@inheritDoc} */
+    @Override public byte readByte() throws IOException {
+        return in.readByte();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int readUnsignedByte() throws IOException {
+        return in.readUnsignedByte();
+    }
+
+    /** {@inheritDoc} */
+    @Override public short readShort() throws IOException {
+        return in.readShort();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int readUnsignedShort() throws IOException {
+        return in.readUnsignedShort();
+    }
+
+    /** {@inheritDoc} */
+    @Override public char readChar() throws IOException {
+        return in.readChar();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int readInt() throws IOException {
+        return in.readInt();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long readLong() throws IOException {
+        return in.readLong();
+    }
+
+    /** {@inheritDoc} */
+    @Override public float readFloat() throws IOException {
+        return in.readFloat();
+    }
+
+    /** {@inheritDoc} */
+    @Override public double readDouble() throws IOException {
+        return in.readDouble();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int read() throws IOException {
+        return in.read();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int read(byte[] b) throws IOException {
+        return in.read(b);
+    }
+
+    /** {@inheritDoc} */
+    @Override public int read(byte[] b, int off, int len) throws IOException {
+        return in.read(b, off, len);
+    }
+
+    /** {@inheritDoc} */
+    @SuppressWarnings("deprecation")
+    @Override public String readLine() throws IOException {
+        return in.readLine();
+    }
+
+    /** {@inheritDoc} */
+    @Override public String readUTF() throws IOException {
+        return in.readUTF();
+    }
+
+    /** {@inheritDoc} */
+    @Override public Object readUnshared() throws IOException, ClassNotFoundException {
+        return readObject();
+    }
+
+    /** {@inheritDoc} */
+    @Override public void defaultReadObject() throws IOException, ClassNotFoundException {
+        if (curObj == null)
+            throw new NotActiveException("Not in readObject() call.");
+
+        readFields(curObj, curFields);
+    }
+
+    /** {@inheritDoc} */
+    @Override public ObjectInputStream.GetField readFields() throws IOException, ClassNotFoundException {
+        if (curObj == null)
+            throw new NotActiveException("Not in readObject() call.");
+
+        return new GetFieldImpl(this);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void registerValidation(ObjectInputValidation obj, int pri) {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public int available() throws IOException {
+        return -1;
+    }
+
+    /**
+     * Returns objects that were added to handles table.
+     * Used ONLY for test purposes.
+     *
+     * @return Handled objects.
+     */
+    Object[] handledObjects() {
+        return handles.entries;
+    }
+
+    /**
+     * Lightweight identity hash table which maps objects to integer handles,
+     * assigned in ascending order.
+     */
+    private static class HandleTable {
+        /** Array mapping handle -> object/exception (depending on status). */
+        private Object[] entries;
+
+        /** Number of handles in table. */
+        private int size;
+
+        /**
+         * Creates handle table with the given initial capacity.
+         *
+         * @param initCap Initial capacity.
+         */
+        HandleTable(int initCap) {
+            entries = new Object[initCap];
+        }
+
+        /**
+         * Assigns next available handle to given object, and returns assigned
+         * handle.
+         *
+         * @param obj Object.
+         * @return Handle.
+         */
+        int assign(Object obj) {
+            if (size >= entries.length)
+                grow();
+
+            entries[size] = obj;
+
+            return size++;
+        }
+
+        /**
+         * Assigns new object to existing handle. Old object is forgotten.
+         *
+         * @param handle Handle.
+         * @param obj Object.
+         */
+        void set(int handle, Object obj) {
+            entries[handle] = obj;
+        }
+
+        /**
+         * Looks up and returns object associated with the given handle.
+         *
+         * @param handle Handle.
+         * @return Object.
+         */
+        Object lookup(int handle) {
+            return entries[handle];
+        }
+
+        /**
+         * Resets table to its initial state.
+         */
+        void clear() {
+            Arrays.fill(entries, 0, size, null);
+
+            size = 0;
+        }
+
+        /**
+         * Expands capacity of internal arrays.
+         */
+        private void grow() {
+            int newCap = (entries.length << 1) + 1;
+
+            Object[] newEntries = new Object[newCap];
+
+            System.arraycopy(entries, 0, newEntries, 0, size);
+
+            entries = newEntries;
+        }
+    }
+
+    /**
+     * {@link GetField} implementation.
+     */
+    private static class GetFieldImpl extends GetField {
+        /** Field info map. */
+        private final Map<String, IgniteBiTuple<Integer, OptimizedFieldType>> fieldInfoMap;
+
+        /** Values. */
+        private final Object[] objs;
+
+        /**
+         * @param in Stream.
+         * @throws IOException In case of error.
+         * @throws ClassNotFoundException If class not found.
+         */
+        @SuppressWarnings("ForLoopReplaceableByForEach")
+        private GetFieldImpl(OptimizedObjectInputStream in) throws IOException, ClassNotFoundException {
+            fieldInfoMap = in.curFieldInfoMap;
+
+            List<IgniteBiTuple<Integer, OptimizedFieldType>> infos = in.curFieldInfoList;
+
+            objs = new Object[infos.size()];
+
+            for (int i = 0; i < infos.size(); i++) {
+                IgniteBiTuple<Integer, OptimizedFieldType> t = infos.get(i);
+
+                Object obj = null;
+
+                switch (t.get2()) {
+                    case BYTE:
+                        obj = in.readByte();
+
+                        break;
+
+                    case SHORT:
+                        obj = in.readShort();
+
+                        break;
+
+                    case INT:
+                        obj = in.readInt();
+
+                        break;
+
+                    case LONG:
+                        obj = in.readLong();
+
+                        break;
+
+                    case FLOAT:
+                        obj = in.readFloat();
+
+                        break;
+
+                    case DOUBLE:
+                        obj = in.readDouble();
+
+                        break;
+
+                    case CHAR:
+                        obj = in.readChar();
+
+                        break;
+
+                    case BOOLEAN:
+                        obj = in.readBoolean();
+
+                        break;
+
+                    case OTHER:
+                        obj = in.readObject();
+                }
+
+                objs[t.get1()] = obj;
+            }
+        }
+
+        /** {@inheritDoc} */
+        @Override public ObjectStreamClass getObjectStreamClass() {
+            throw new UnsupportedOperationException();
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean defaulted(String name) throws IOException {
+            return objs[fieldInfoMap.get(name).get1()] == null;
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean get(String name, boolean dflt) throws IOException {
+            return value(name, dflt);
+        }
+
+        /** {@inheritDoc} */
+        @Override public byte get(String name, byte dflt) throws IOException {
+            return value(name, dflt);
+        }
+
+        /** {@inheritDoc} */
+        @Override public char get(String name, char dflt) throws IOException {
+            return value(name, dflt);
+        }
+
+        /** {@inheritDoc} */
+        @Override public short get(String name, short dflt) throws IOException {
+            return value(name, dflt);
+        }
+
+        /** {@inheritDoc} */
+        @Override public int get(String name, int dflt) throws IOException {
+            return value(name, dflt);
+        }
+
+        /** {@inheritDoc} */
+        @Override public long get(String name, long dflt) throws IOException {
+            return value(name, dflt);
+        }
+
+        /** {@inheritDoc} */
+        @Override public float get(String name, float dflt) throws IOException {
+            return value(name, dflt);
+        }
+
+        /** {@inheritDoc} */
+        @Override public double get(String name, double dflt) throws IOException {
+            return value(name, dflt);
+        }
+
+        /** {@inheritDoc} */
+        @Override public Object get(String name, Object dflt) throws IOException {
+            return value(name, dflt);
+        }
+
+        /**
+         * @param name Field name.
+         * @param dflt Default value.
+         * @return Value.
+         */
+        private <T> T value(String name, T dflt) {
+            return objs[fieldInfoMap.get(name).get1()] != null ? (T)objs[fieldInfoMap.get(name).get1()] : dflt;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5674cdde/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
new file mode 100644
index 0000000..8fd7202
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedObjectOutputStream.java
@@ -0,0 +1,839 @@
+/*
+ * 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.io.*;
+import org.apache.ignite.internal.util.typedef.*;
+import org.apache.ignite.lang.*;
+
+import java.io.*;
+import java.lang.reflect.*;
+import java.util.*;
+
+import static org.apache.ignite.marshaller.optimized.OptimizedMarshallerUtils.*;
+
+/**
+ * Optimized object output stream.
+ */
+class OptimizedObjectOutputStream extends ObjectOutputStream {
+    /** */
+    private static final Collection<String> CONVERTED_ERR = F.asList(
+        "weblogic/management/ManagementException",
+        "Externalizable class doesn't have default constructor: class " +
+            "org.gridgain.grid.kernal.processors.email.GridEmailProcessor$2"
+    );
+
+    /** */
+    private final GridHandleTable handles = new GridHandleTable(10, 3.00f);
+
+    /** */
+    private boolean requireSer;
+
+    /** */
+    private GridDataOutput out;
+
+    /** */
+    private Object curObj;
+
+    /** */
+    private List<T2<OptimizedFieldType, Long>> curFields;
+
+    /** */
+    private Map<String, IgniteBiTuple<Integer, OptimizedFieldType>> curFieldInfoMap;
+
+    /** */
+    private PutFieldImpl curPut;
+
+
+    /**
+     * @throws IOException In case of error.
+     */
+    OptimizedObjectOutputStream() throws IOException {
+        // No-op.
+    }
+
+    /**
+     * @param out Output.
+     * @throws IOException In case of error.
+     */
+    OptimizedObjectOutputStream(GridDataOutput out) throws IOException {
+        this.out = out;
+    }
+
+    /**
+     * @param requireSer Require {@link Serializable} flag.
+     */
+    void requireSerializable(boolean requireSer) {
+        this.requireSer = requireSer;
+    }
+
+    /**
+     * @return Require {@link Serializable} flag.
+     */
+    boolean requireSerializable() {
+        return requireSer;
+    }
+
+    /**
+     * @param out Output.
+     */
+    public void out(GridDataOutput out) {
+        this.out = out;
+    }
+
+    /**
+     * @return Output.
+     */
+    public GridDataOutput out() {
+        return out;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void close() throws IOException {
+        reset();
+    }
+
+    /** {@inheritDoc} */
+    @Override public void write(byte[] b) throws IOException {
+        out.write(b);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void write(byte[] b, int off, int len) throws IOException {
+        out.write(b, off, len);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void writeObjectOverride(Object obj) throws IOException {
+        try {
+            writeObject0(obj);
+        }
+        catch (IOException e) {
+            Throwable t = e;
+
+            do {
+                if (CONVERTED_ERR.contains(t.getMessage()))
+                    throw new IOException("You are trying to serialize internal classes that are not supposed " +
+                        "to be serialized. Check that all non-serializable fields are transient. Consider using " +
+                        "static inner classes instead of non-static inner classes and anonymous classes.", e);
+            }
+            while ((t = t.getCause()) != null);
+
+            throw e;
+        }
+    }
+
+    /**
+     * Writes object to stream.
+     *
+     * @param obj Object.
+     * @throws IOException In case of error.
+     */
+    private void writeObject0(Object obj) throws IOException {
+        curObj = null;
+        curFields = null;
+        curPut = null;
+        curFieldInfoMap = null;
+
+        if (obj == null)
+            writeByte(NULL);
+        else {
+            Class<?> cls = obj.getClass();
+
+            OptimizedClassDescriptor desc = classDescriptor(cls, obj);
+
+            if (desc.excluded()) {
+                writeByte(NULL);
+
+                return;
+            }
+
+            Object obj0 = desc.replace(obj);
+
+            if (obj0 == null) {
+                writeByte(NULL);
+
+                return;
+            }
+
+            int handle = -1;
+
+            if (!desc.isPrimitive() && !desc.isEnum() && !desc.isClass())
+                handle = handles.lookup(obj);
+
+            if (obj0 != obj) {
+                obj = obj0;
+
+                desc = classDescriptor(obj.getClass(), obj);
+            }
+
+            if (handle >= 0) {
+                writeByte(HANDLE);
+                writeInt(handle);
+            }
+            else {
+                writeByte(OBJECT);
+
+                OptimizedClassResolver.writeClass(this, desc);
+
+                desc.write(this, obj);
+            }
+        }
+    }
+
+    /**
+     * Writes array to this stream.
+     *
+     * @param arr Array.
+     * @throws IOException In case of error.
+     */
+    @SuppressWarnings("ForLoopReplaceableByForEach")
+    void writeArray(Object[] arr) throws IOException {
+        int len = arr.length;
+
+        writeInt(len);
+
+        for (int i = 0; i < len; i++) {
+            Object obj = arr[i];
+
+            writeObject0(obj);
+        }
+    }
+
+    /**
+     * Writes {@link UUID} to this stream.
+     *
+     * @param uuid UUID.
+     * @throws IOException In case of error.
+     */
+    void writeUuid(UUID uuid) throws IOException {
+        writeLong(uuid.getMostSignificantBits());
+        writeLong(uuid.getLeastSignificantBits());
+    }
+
+    /**
+     * Writes {@link Properties} to this stream.
+     *
+     * @param props Properties.
+     * @param dfltsFieldOff Defaults field offset.
+     * @throws IOException In case of error.
+     */
+    void writeProperties(Properties props, long dfltsFieldOff) throws IOException {
+        Properties dflts = (Properties)getObject(props, dfltsFieldOff);
+
+        if (dflts == null)
+            writeBoolean(true);
+        else {
+            writeBoolean(false);
+
+            writeObject0(dflts);
+        }
+
+        Set<String> names = props.stringPropertyNames();
+
+        writeInt(names.size());
+
+        for (String name : names) {
+            writeUTF(name);
+            writeUTF(props.getProperty(name));
+        }
+    }
+
+    /**
+     * Writes externalizable object.
+     *
+     * @param obj Object.
+     * @throws IOException In case of error.
+     */
+    void writeExternalizable(Object obj) throws IOException {
+        Externalizable extObj = (Externalizable)obj;
+
+        extObj.writeExternal(this);
+    }
+
+    /**
+     * Writes serializable object.
+     *
+     * @param obj Object.
+     * @param mtds {@code writeObject} methods.
+     * @param fields class fields details.
+     * @throws IOException In case of error.
+     */
+    @SuppressWarnings("ForLoopReplaceableByForEach")
+    void writeSerializable(Object obj, List<Method> mtds, OptimizedClassDescriptor.Fields fields)
+        throws IOException {
+        for (int i = 0; i < mtds.size(); i++) {
+            Method mtd = mtds.get(i);
+
+            if (mtd != null) {
+                curObj = obj;
+                curFields = fields.fieldOffs(i);
+                curFieldInfoMap = fields.fieldInfoMap(i);
+
+                try {
+                    mtd.invoke(obj, this);
+                }
+                catch (IllegalAccessException e) {
+                    throw new IOException(e);
+                }
+                catch (InvocationTargetException e) {
+                    throw new IOException(e.getCause());
+                }
+            }
+            else
+                writeFields(obj, fields.fieldOffs(i));
+        }
+    }
+
+    /**
+     * Writes {@link ArrayList}.
+     *
+     * @param list List.
+     * @throws IOException In case of error.
+     */
+    @SuppressWarnings({"ForLoopReplaceableByForEach", "TypeMayBeWeakened"})
+    void writeArrayList(ArrayList<?> list) throws IOException {
+        int size = list.size();
+
+        writeInt(size);
+
+        for (int i = 0; i < size; i++)
+            writeObject0(list.get(i));
+    }
+
+    /**
+     * Writes {@link HashMap}.
+     *
+     * @param map Map.
+     * @param loadFactorFieldOff Load factor field offset.
+     * @param set Whether writing underlying map from {@link HashSet}.
+     * @throws IOException In case of error.
+     */
+    @SuppressWarnings("TypeMayBeWeakened")
+    void writeHashMap(HashMap<?, ?> map, long loadFactorFieldOff, boolean set) throws IOException {
+        int size = map.size();
+
+        writeInt(size);
+        writeFloat(getFloat(map, loadFactorFieldOff));
+
+        for (Map.Entry<?, ?> e : map.entrySet()) {
+            writeObject0(e.getKey());
+
+            if (!set)
+                writeObject0(e.getValue());
+        }
+    }
+
+    /**
+     * Writes {@link HashSet}.
+     *
+     * @param set Set.
+     * @param mapFieldOff Map field offset.
+     * @param loadFactorFieldOff Load factor field offset.
+     * @throws IOException In case of error.
+     */
+    void writeHashSet(HashSet<?> set, long mapFieldOff, long loadFactorFieldOff) throws IOException {
+        writeHashMap((HashMap<?, ?>)getObject(set, mapFieldOff), loadFactorFieldOff, true);
+    }
+
+    /**
+     * Writes {@link LinkedList}.
+     *
+     * @param list List.
+     * @throws IOException In case of error.
+     */
+    @SuppressWarnings("TypeMayBeWeakened")
+    void writeLinkedList(LinkedList<?> list) throws IOException {
+        int size = list.size();
+
+        writeInt(size);
+
+        for (Object obj : list)
+            writeObject0(obj);
+    }
+
+    /**
+     * Writes {@link LinkedHashMap}.
+     *
+     * @param map Map.
+     * @param loadFactorFieldOff Load factor field offset.
+     * @param accessOrderFieldOff access order field offset.
+     * @param set Whether writing underlying map from {@link LinkedHashSet}.
+     * @throws IOException In case of error.
+     */
+    @SuppressWarnings("TypeMayBeWeakened")
+    void writeLinkedHashMap(LinkedHashMap<?, ?> map, long loadFactorFieldOff, long accessOrderFieldOff, boolean set)
+        throws IOException {
+        int size = map.size();
+
+        writeInt(size);
+        writeFloat(getFloat(map, loadFactorFieldOff));
+
+        if (accessOrderFieldOff >= 0)
+            writeBoolean(getBoolean(map, accessOrderFieldOff));
+        else
+            writeBoolean(false);
+
+        for (Map.Entry<?, ?> e : map.entrySet()) {
+            writeObject0(e.getKey());
+
+            if (!set)
+                writeObject0(e.getValue());
+        }
+    }
+
+    /**
+     * Writes {@link LinkedHashSet}.
+     *
+     * @param set Set.
+     * @param mapFieldOff Map field offset.
+     * @param loadFactorFieldOff Load factor field offset.
+     * @throws IOException In case of error.
+     */
+    void writeLinkedHashSet(LinkedHashSet<?> set, long mapFieldOff, long loadFactorFieldOff) throws IOException {
+        LinkedHashMap<?, ?> map = (LinkedHashMap<?, ?>)getObject(set, mapFieldOff);
+
+        writeLinkedHashMap(map, loadFactorFieldOff, -1, true);
+    }
+
+    /**
+     * Writes {@link Date}.
+     *
+     * @param date Date.
+     * @throws IOException In case of error.
+     */
+    void writeDate(Date date) throws IOException {
+        writeLong(date.getTime());
+    }
+
+    /**
+     * Writes all non-static and non-transient field values to this stream.
+     *
+     * @param obj Object.
+     * @param fieldOffs Field offsets.
+     * @throws IOException In case of error.
+     */
+    @SuppressWarnings("ForLoopReplaceableByForEach")
+    private void writeFields(Object obj, List<T2<OptimizedFieldType, Long>> fieldOffs) throws IOException {
+        for (int i = 0; i < fieldOffs.size(); i++) {
+            T2<OptimizedFieldType, Long> t = fieldOffs.get(i);
+
+            switch (t.get1()) {
+                case BYTE:
+                    writeByte(getByte(obj, t.get2()));
+
+                    break;
+
+                case SHORT:
+                    writeShort(getShort(obj, t.get2()));
+
+                    break;
+
+                case INT:
+                    writeInt(getInt(obj, t.get2()));
+
+                    break;
+
+                case LONG:
+                    writeLong(getLong(obj, t.get2()));
+
+                    break;
+
+                case FLOAT:
+                    writeFloat(getFloat(obj, t.get2()));
+
+                    break;
+
+                case DOUBLE:
+                    writeDouble(getDouble(obj, t.get2()));
+
+                    break;
+
+                case CHAR:
+                    writeChar(getChar(obj, t.get2()));
+
+                    break;
+
+                case BOOLEAN:
+                    writeBoolean(getBoolean(obj, t.get2()));
+
+                    break;
+
+                case OTHER:
+                    writeObject0(getObject(obj, t.get2()));
+            }
+        }
+    }
+
+    /**
+     * Writes array of {@code byte}s.
+     *
+     * @param arr Array.
+     * @throws IOException In case of error.
+     */
+    void writeByteArray(byte[] arr) throws IOException {
+        out.writeByteArray(arr);
+    }
+
+    /**
+     * Writes array of {@code short}s.
+     *
+     * @param arr Array.
+     * @throws IOException In case of error.
+     */
+    void writeShortArray(short[] arr) throws IOException {
+        out.writeShortArray(arr);
+    }
+
+    /**
+     * Writes array of {@code int}s.
+     *
+     * @param arr Array.
+     * @throws IOException In case of error.
+     */
+    void writeIntArray(int[] arr) throws IOException {
+        out.writeIntArray(arr);
+    }
+
+    /**
+     * Writes array of {@code long}s.
+     *
+     * @param arr Array.
+     * @throws IOException In case of error.
+     */
+    void writeLongArray(long[] arr) throws IOException {
+        out.writeLongArray(arr);
+    }
+
+    /**
+     * Writes array of {@code float}s.
+     *
+     * @param arr Array.
+     * @throws IOException In case of error.
+     */
+    void writeFloatArray(float[] arr) throws IOException {
+        out.writeFloatArray(arr);
+    }
+
+    /**
+     * Writes array of {@code double}s.
+     *
+     * @param arr Array.
+     * @throws IOException In case of error.
+     */
+    void writeDoubleArray(double[] arr) throws IOException {
+        out.writeDoubleArray(arr);
+    }
+
+    /**
+     * Writes array of {@code char}s.
+     *
+     * @param arr Array.
+     * @throws IOException In case of error.
+     */
+    void writeCharArray(char[] arr) throws IOException {
+        out.writeCharArray(arr);
+    }
+
+    /**
+     * Writes array of {@code boolean}s.
+     *
+     * @param arr Array.
+     * @throws IOException In case of error.
+     */
+    void writeBooleanArray(boolean[] arr) throws IOException {
+        out.writeBooleanArray(arr);
+    }
+
+    /**
+     * Writes {@link String}.
+     *
+     * @param str String.
+     * @throws IOException In case of error.
+     */
+    void writeString(String str) throws IOException {
+        out.writeUTF(str);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeBoolean(boolean v) throws IOException {
+        out.writeBoolean(v);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeByte(int v) throws IOException {
+        out.writeByte(v);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeShort(int v) throws IOException {
+        out.writeShort(v);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeChar(int v) throws IOException {
+        out.writeChar(v);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeInt(int v) throws IOException {
+        out.writeInt(v);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeLong(long v) throws IOException {
+        out.writeLong(v);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeFloat(float v) throws IOException {
+        out.writeFloat(v);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeDouble(double v) throws IOException {
+        out.writeDouble(v);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void write(int b) throws IOException {
+        writeByte(b);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeBytes(String s) throws IOException {
+        out.writeBytes(s);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeChars(String s) throws IOException {
+        out.writeChars(s);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeUTF(String s) throws IOException {
+        out.writeUTF(s);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void useProtocolVersion(int ver) throws IOException {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeUnshared(Object obj) throws IOException {
+        writeObject0(obj);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void defaultWriteObject() throws IOException {
+        if (curObj == null)
+            throw new NotActiveException("Not in writeObject() call.");
+
+        writeFields(curObj, curFields);
+    }
+
+    /** {@inheritDoc} */
+    @Override public ObjectOutputStream.PutField putFields() throws IOException {
+        if (curObj == null)
+            throw new NotActiveException("Not in writeObject() call or fields already written.");
+
+        if (curPut == null)
+            curPut = new PutFieldImpl(this);
+
+        return curPut;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeFields() throws IOException {
+        if (curObj == null)
+            throw new NotActiveException("Not in writeObject() call.");
+
+        if (curPut == null)
+            throw new NotActiveException("putFields() was not called.");
+
+        for (IgniteBiTuple<OptimizedFieldType, Object> t : curPut.objs) {
+            switch (t.get1()) {
+                case BYTE:
+                    writeByte((Byte)t.get2());
+
+                    break;
+
+                case SHORT:
+                    writeShort((Short)t.get2());
+
+                    break;
+
+                case INT:
+                    writeInt((Integer)t.get2());
+
+                    break;
+
+                case LONG:
+                    writeLong((Long)t.get2());
+
+                    break;
+
+                case FLOAT:
+                    writeFloat((Float)t.get2());
+
+                    break;
+
+                case DOUBLE:
+                    writeDouble((Double)t.get2());
+
+                    break;
+
+                case CHAR:
+                    writeChar((Character)t.get2());
+
+                    break;
+
+                case BOOLEAN:
+                    writeBoolean((Boolean)t.get2());
+
+                    break;
+
+                case OTHER:
+                    writeObject0(t.get2());
+            }
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public void reset() throws IOException {
+        out.reset();
+        handles.clear();
+
+        curObj = null;
+        curFields = null;
+        curPut = null;
+        curFieldInfoMap = null;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void flush() throws IOException {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public void drain() throws IOException {
+        // No-op.
+    }
+
+    /**
+     * Returns objects that were added to handles table.
+     * Used ONLY for test purposes.
+     *
+     * @return Handled objects.
+     */
+    Object[] handledObjects() {
+        return handles.objects();
+    }
+
+    /**
+     * {@link PutField} implementation.
+     */
+    private static class PutFieldImpl extends PutField {
+        /** Stream. */
+        private final OptimizedObjectOutputStream out;
+
+        /** Field info map. */
+        private final Map<String, IgniteBiTuple<Integer, OptimizedFieldType>> fieldInfoMap;
+
+        /** Values. */
+        private final IgniteBiTuple<OptimizedFieldType, Object>[] objs;
+
+        /**
+         * @param out Output stream.
+         * @throws IOException In case of error.
+         */
+        @SuppressWarnings("unchecked")
+        private PutFieldImpl(OptimizedObjectOutputStream out) {
+            this.out = out;
+
+            fieldInfoMap = out.curFieldInfoMap;
+
+            objs = new IgniteBiTuple[fieldInfoMap.size()];
+        }
+
+        /** {@inheritDoc} */
+        @Override public void put(String name, boolean val) {
+            value(name, val);
+        }
+
+        /** {@inheritDoc} */
+        @Override public void put(String name, byte val) {
+            value(name, val);
+        }
+
+        /** {@inheritDoc} */
+        @Override public void put(String name, char val) {
+            value(name, val);
+        }
+
+        /** {@inheritDoc} */
+        @Override public void put(String name, short val) {
+            value(name, val);
+        }
+
+        /** {@inheritDoc} */
+        @Override public void put(String name, int val) {
+            value(name, val);
+        }
+
+        /** {@inheritDoc} */
+        @Override public void put(String name, long val) {
+            value(name, val);
+        }
+
+        /** {@inheritDoc} */
+        @Override public void put(String name, float val) {
+            value(name, val);
+        }
+
+        /** {@inheritDoc} */
+        @Override public void put(String name, double val) {
+            value(name, val);
+        }
+
+        /** {@inheritDoc} */
+        @Override public void put(String name, Object val) {
+            value(name, val);
+        }
+
+        /** {@inheritDoc} */
+        @Override public void write(ObjectOutput out) throws IOException {
+            if (out != this.out)
+                throw new IllegalArgumentException("Wrong stream.");
+
+            this.out.writeFields();
+        }
+
+        /**
+         * @param name Field name.
+         * @param val Value.
+         */
+        private void value(String name, Object val) {
+            IgniteBiTuple<Integer, OptimizedFieldType> info = fieldInfoMap.get(name);
+
+            objs[info.get1()] = F.t(info.get2(), val);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5674cdde/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedObjectStreamRegistry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedObjectStreamRegistry.java b/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedObjectStreamRegistry.java
new file mode 100644
index 0000000..ae28015
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedObjectStreamRegistry.java
@@ -0,0 +1,224 @@
+/*
+ * 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.*;
+import org.apache.ignite.internal.*;
+import org.apache.ignite.internal.util.io.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
+
+import java.io.*;
+import java.util.concurrent.*;
+
+/**
+ * Storage for object streams.
+ */
+class OptimizedObjectStreamRegistry {
+    /** Holders. */
+    private static final ThreadLocal<StreamHolder> holders = new ThreadLocal<>();
+
+    /** Holders pool. */
+    private static BlockingQueue<StreamHolder> pool;
+
+    /**
+     * Ensures singleton.
+     */
+    private OptimizedObjectStreamRegistry() {
+        // No-op.
+    }
+
+    /**
+     * Sets streams pool size.
+     *
+     * @param size Streams pool size.
+     */
+    static void poolSize(int size) {
+        if (size > 0) {
+            pool = new LinkedBlockingQueue<>(size);
+
+            for (int i = 0; i < size; i++) {
+                boolean b = pool.offer(new StreamHolder());
+
+                assert b;
+            }
+        }
+        else
+            pool = null;
+    }
+
+    /**
+     * Gets output stream.
+     *
+     * @return Object output stream.
+     * @throws org.apache.ignite.internal.IgniteInterruptedCheckedException If thread is interrupted while trying to take holder from pool.
+     */
+    static OptimizedObjectOutputStream out() throws IgniteInterruptedCheckedException {
+        return holder().acquireOut();
+    }
+
+    /**
+     * Gets input stream.
+     *
+     * @return Object input stream.
+     * @throws org.apache.ignite.internal.IgniteInterruptedCheckedException If thread is interrupted while trying to take holder from pool.
+     */
+    static OptimizedObjectInputStream in() throws IgniteInterruptedCheckedException {
+        return holder().acquireIn();
+    }
+
+    /**
+     * Closes and releases output stream.
+     *
+     * @param out Object output stream.
+     */
+    static void closeOut(OptimizedObjectOutputStream out) {
+        U.close(out, null);
+
+        StreamHolder holder = holders.get();
+
+        holder.releaseOut();
+
+        if (pool != null) {
+            holders.remove();
+
+            boolean b = pool.offer(holder);
+
+            assert b;
+        }
+    }
+
+    /**
+     * Closes and releases input stream.
+     *
+     * @param in Object input stream.
+     */
+    @SuppressWarnings("TypeMayBeWeakened")
+    static void closeIn(OptimizedObjectInputStream in) {
+        U.close(in, null);
+
+        StreamHolder holder = holders.get();
+
+        holder.releaseIn();
+
+        if (pool != null) {
+            holders.remove();
+
+            boolean b = pool.offer(holder);
+
+            assert b;
+        }
+    }
+
+    /**
+     * Gets holder from pool or thread local.
+     *
+     * @return Stream holder.
+     * @throws org.apache.ignite.internal.IgniteInterruptedCheckedException If thread is interrupted while trying to take holder from pool.
+     */
+    private static StreamHolder holder() throws IgniteInterruptedCheckedException {
+        StreamHolder holder = holders.get();
+
+        if (holder == null) {
+            try {
+                holders.set(holder = pool != null ? pool.take() : new StreamHolder());
+            }
+            catch (InterruptedException e) {
+                throw new IgniteInterruptedCheckedException("Failed to take object stream from pool (thread interrupted).", e);
+            }
+        }
+
+        return holder;
+    }
+
+    /**
+     * Streams holder.
+     */
+    private static class StreamHolder {
+        /** Output stream. */
+        private final OptimizedObjectOutputStream out = createOut();
+
+        /** Input stream. */
+        private final OptimizedObjectInputStream in = createIn();
+
+        /** Output streams counter. */
+        private int outAcquireCnt;
+
+        /** Input streams counter. */
+        private int inAcquireCnt;
+
+        /**
+         * Gets output stream.
+         *
+         * @return Object output stream.
+         */
+        OptimizedObjectOutputStream acquireOut() {
+            return outAcquireCnt++ > 0 ? createOut() : out;
+        }
+
+        /**
+         * Gets input stream.
+         *
+         * @return Object input stream.
+         */
+        OptimizedObjectInputStream acquireIn() {
+            return inAcquireCnt++ > 0 ? createIn() : in;
+        }
+
+        /**
+         * Releases output stream.
+         */
+        void releaseOut() {
+            outAcquireCnt--;
+        }
+
+        /**
+         * Releases input stream.
+         */
+        void releaseIn() {
+            inAcquireCnt--;
+        }
+
+        /**
+         * Creates output stream.
+         *
+         * @return Object output stream.
+         */
+        private OptimizedObjectOutputStream createOut() {
+            try {
+                return new OptimizedObjectOutputStream(new GridUnsafeDataOutput(4 * 1024));
+            }
+            catch (IOException e) {
+                throw new IgniteException("Failed to create object output stream.", e);
+            }
+        }
+
+        /**
+         * Creates input stream.
+         *
+         * @return Object input stream.
+         */
+        private OptimizedObjectInputStream createIn() {
+            try {
+                return new OptimizedObjectInputStream(new GridUnsafeDataInput());
+            }
+            catch (IOException e) {
+                throw new IgniteException("Failed to create object input stream.", e);
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5674cdde/modules/core/src/main/java/org/apache/ignite/spi/checkpoint/sharedfs/SharedFsCheckpointSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/checkpoint/sharedfs/SharedFsCheckpointSpi.java b/modules/core/src/main/java/org/apache/ignite/spi/checkpoint/sharedfs/SharedFsCheckpointSpi.java
index d967b4a..a802653 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/checkpoint/sharedfs/SharedFsCheckpointSpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/checkpoint/sharedfs/SharedFsCheckpointSpi.java
@@ -291,7 +291,7 @@ public class SharedFsCheckpointSpi extends IgniteSpiAdapter implements Checkpoin
         if (folder != null) {
             Map<File, SharedFsTimeData> files = new HashMap<>();
 
-            IgniteMarshaller marsh = ignite.configuration().getMarshaller();
+            Marshaller marsh = ignite.configuration().getMarshaller();
 
             // Track expiration for only those files that are made by this node
             // to avoid file access conflicts.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5674cdde/modules/core/src/main/java/org/apache/ignite/spi/checkpoint/sharedfs/SharedFsTimeoutTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/checkpoint/sharedfs/SharedFsTimeoutTask.java b/modules/core/src/main/java/org/apache/ignite/spi/checkpoint/sharedfs/SharedFsTimeoutTask.java
index a45c7b5..5f82115 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/checkpoint/sharedfs/SharedFsTimeoutTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/checkpoint/sharedfs/SharedFsTimeoutTask.java
@@ -43,7 +43,7 @@ class SharedFsTimeoutTask extends IgniteSpiThread {
     private IgniteLogger log;
 
     /** Messages marshaller. */
-    private IgniteMarshaller marshaller;
+    private Marshaller marshaller;
 
     /** */
     private final Object mux = new Object();
@@ -58,7 +58,7 @@ class SharedFsTimeoutTask extends IgniteSpiThread {
      * @param marshaller Messages marshaller.
      * @param log Messages logger.
      */
-    SharedFsTimeoutTask(String gridName, IgniteMarshaller marshaller, IgniteLogger log) {
+    SharedFsTimeoutTask(String gridName, Marshaller marshaller, IgniteLogger log) {
         super(gridName, "grid-sharedfs-timeout-worker", log);
 
         assert marshaller != null;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5674cdde/modules/core/src/main/java/org/apache/ignite/spi/checkpoint/sharedfs/SharedFsUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/checkpoint/sharedfs/SharedFsUtils.java b/modules/core/src/main/java/org/apache/ignite/spi/checkpoint/sharedfs/SharedFsUtils.java
index 1e2cad2..5d7ae36 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/checkpoint/sharedfs/SharedFsUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/checkpoint/sharedfs/SharedFsUtils.java
@@ -47,7 +47,7 @@ final class SharedFsUtils {
      *    to {@link SharedFsCheckpointData} object.
      * @throws IOException Thrown if file read error occurred.
      */
-    static SharedFsCheckpointData read(File file, IgniteMarshaller m, IgniteLogger log)
+    static SharedFsCheckpointData read(File file, Marshaller m, IgniteLogger log)
         throws IOException, IgniteCheckedException {
         assert file != null;
         assert m != null;
@@ -74,7 +74,7 @@ final class SharedFsUtils {
      * @throws IgniteCheckedException Thrown if data could not be marshalled.
      * @throws IOException Thrown if file write operation failed.
      */
-    static void write(File file, SharedFsCheckpointData data, IgniteMarshaller m, IgniteLogger log)
+    static void write(File file, SharedFsCheckpointData data, Marshaller m, IgniteLogger log)
         throws IOException, IgniteCheckedException {
         assert file != null;
         assert m != null;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5674cdde/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiAdapter.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiAdapter.java
index 4ba86d0..2085d1b 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiAdapter.java
@@ -135,7 +135,7 @@ abstract class TcpDiscoverySpiAdapter extends IgniteSpiAdapter implements Discov
     protected volatile long gridStartTime;
 
     /** Marshaller. */
-    protected final IgniteMarshaller marsh = new IgniteJdkMarshaller();
+    protected final Marshaller marsh = new JdkMarshaller();
 
     /** Statistics. */
     protected final TcpDiscoveryStatistics stats = new TcpDiscoveryStatistics();

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5674cdde/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/multicast/TcpDiscoveryMulticastIpFinder.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/multicast/TcpDiscoveryMulticastIpFinder.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/multicast/TcpDiscoveryMulticastIpFinder.java
index 62edcdd..9b9b3dd 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/multicast/TcpDiscoveryMulticastIpFinder.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/multicast/TcpDiscoveryMulticastIpFinder.java
@@ -77,7 +77,7 @@ public class TcpDiscoveryMulticastIpFinder extends TcpDiscoveryVmIpFinder {
     private static final byte[] MSG_ADDR_REQ_DATA = U.IGNITE_HEADER;
 
     /** */
-    private static final IgniteMarshaller marsh = new IgniteJdkMarshaller();
+    private static final Marshaller marsh = new JdkMarshaller();
 
     /** Grid logger. */
     @IgniteLoggerResource

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5674cdde/modules/core/src/test/config/example-cache.xml
----------------------------------------------------------------------
diff --git a/modules/core/src/test/config/example-cache.xml b/modules/core/src/test/config/example-cache.xml
index ca4015c..3145b24 100644
--- a/modules/core/src/test/config/example-cache.xml
+++ b/modules/core/src/test/config/example-cache.xml
@@ -44,7 +44,7 @@
         <property name="peerClassLoadingEnabled" value="true"/>
 
         <property name="marshaller">
-            <bean class="org.apache.ignite.marshaller.optimized.IgniteOptimizedMarshaller">
+            <bean class="org.apache.ignite.marshaller.optimized.OptimizedMarshaller">
                 <!-- Set to false to allow non-serializable objects in examples, default is true. -->
                 <property name="requireSerializable" value="false"/>
             </bean>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5674cdde/modules/core/src/test/config/ggfs-loopback.xml
----------------------------------------------------------------------
diff --git a/modules/core/src/test/config/ggfs-loopback.xml b/modules/core/src/test/config/ggfs-loopback.xml
index b06c581..8764533 100644
--- a/modules/core/src/test/config/ggfs-loopback.xml
+++ b/modules/core/src/test/config/ggfs-loopback.xml
@@ -64,7 +64,7 @@
             Configure optimized marshaller.
         -->
         <property name="marshaller">
-            <bean class="org.apache.ignite.marshaller.optimized.IgniteOptimizedMarshaller">
+            <bean class="org.apache.ignite.marshaller.optimized.OptimizedMarshaller">
                 <!--
                     For better performance set this property to true in case
                     all marshalled classes implement java.io.Serializable.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5674cdde/modules/core/src/test/config/ggfs-shmem.xml
----------------------------------------------------------------------
diff --git a/modules/core/src/test/config/ggfs-shmem.xml b/modules/core/src/test/config/ggfs-shmem.xml
index dff6851..f3a943b 100644
--- a/modules/core/src/test/config/ggfs-shmem.xml
+++ b/modules/core/src/test/config/ggfs-shmem.xml
@@ -64,7 +64,7 @@
             Configure optimized marshaller.
         -->
         <property name="marshaller">
-            <bean class="org.apache.ignite.marshaller.optimized.IgniteOptimizedMarshaller">
+            <bean class="org.apache.ignite.marshaller.optimized.OptimizedMarshaller">
                 <!--
                     For better performance set this property to true in case
                     all marshalled classes implement java.io.Serializable.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5674cdde/modules/core/src/test/config/io-manager-benchmark.xml
----------------------------------------------------------------------
diff --git a/modules/core/src/test/config/io-manager-benchmark.xml b/modules/core/src/test/config/io-manager-benchmark.xml
index f08bf59..d052d03 100644
--- a/modules/core/src/test/config/io-manager-benchmark.xml
+++ b/modules/core/src/test/config/io-manager-benchmark.xml
@@ -34,7 +34,7 @@
         </property>
 
         <property name="marshaller">
-            <bean class="org.apache.ignite.marshaller.optimized.IgniteOptimizedMarshaller">
+            <bean class="org.apache.ignite.marshaller.optimized.OptimizedMarshaller">
                 <property name="requireSerializable" value="true"/>
 
                 <property name="classNames">

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5674cdde/modules/core/src/test/config/jobs-load-base.xml
----------------------------------------------------------------------
diff --git a/modules/core/src/test/config/jobs-load-base.xml b/modules/core/src/test/config/jobs-load-base.xml
index a4f0947..9881973 100644
--- a/modules/core/src/test/config/jobs-load-base.xml
+++ b/modules/core/src/test/config/jobs-load-base.xml
@@ -30,7 +30,7 @@
         <property name="localHost" value="127.0.0.1"/>
 
         <property name="marshaller">
-            <bean class="org.apache.ignite.marshaller.optimized.IgniteOptimizedMarshaller">
+            <bean class="org.apache.ignite.marshaller.optimized.OptimizedMarshaller">
                 <property name="classNames">
                     <list>
                         <value>org.apache.ignite.loadtests.job.GridJobExecutionLoadTestJob</value>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5674cdde/modules/core/src/test/config/load/dsi-load-base.xml
----------------------------------------------------------------------
diff --git a/modules/core/src/test/config/load/dsi-load-base.xml b/modules/core/src/test/config/load/dsi-load-base.xml
index 1e5ba3d..a50c600 100644
--- a/modules/core/src/test/config/load/dsi-load-base.xml
+++ b/modules/core/src/test/config/load/dsi-load-base.xml
@@ -33,7 +33,7 @@
         <property name="localHost" value="127.0.0.1"/>
 
         <property name="marshaller">
-            <bean class="org.apache.ignite.marshaller.optimized.IgniteOptimizedMarshaller">
+            <bean class="org.apache.ignite.marshaller.optimized.OptimizedMarshaller">
                 <property name="classNames">
                     <list>
                         <value>org.apache.ignite.loadtests.dsi.GridDsiSession</value>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5674cdde/modules/core/src/test/config/spring-start-nodes-attr.xml
----------------------------------------------------------------------
diff --git a/modules/core/src/test/config/spring-start-nodes-attr.xml b/modules/core/src/test/config/spring-start-nodes-attr.xml
index 3c18ed0..cee666d 100644
--- a/modules/core/src/test/config/spring-start-nodes-attr.xml
+++ b/modules/core/src/test/config/spring-start-nodes-attr.xml
@@ -37,7 +37,7 @@
         <property name="restEnabled" value="false"/>
 
         <property name="marshaller">
-            <bean class="org.apache.ignite.marshaller.optimized.IgniteOptimizedMarshaller">
+            <bean class="org.apache.ignite.marshaller.optimized.OptimizedMarshaller">
                 <property name="requireSerializable" value="false"/>
             </bean>
         </property>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5674cdde/modules/core/src/test/config/spring-start-nodes.xml
----------------------------------------------------------------------
diff --git a/modules/core/src/test/config/spring-start-nodes.xml b/modules/core/src/test/config/spring-start-nodes.xml
index 38a6188..88740a7 100644
--- a/modules/core/src/test/config/spring-start-nodes.xml
+++ b/modules/core/src/test/config/spring-start-nodes.xml
@@ -31,7 +31,7 @@
         <property name="restEnabled" value="false"/>
 
         <property name="marshaller">
-            <bean class="org.apache.ignite.marshaller.optimized.IgniteOptimizedMarshaller">
+            <bean class="org.apache.ignite.marshaller.optimized.OptimizedMarshaller">
                 <property name="requireSerializable" value="false"/>
             </bean>
         </property>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5674cdde/modules/core/src/test/java/org/apache/ignite/GridTestIoUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/GridTestIoUtils.java b/modules/core/src/test/java/org/apache/ignite/GridTestIoUtils.java
index 24714cb..2dc5faa 100644
--- a/modules/core/src/test/java/org/apache/ignite/GridTestIoUtils.java
+++ b/modules/core/src/test/java/org/apache/ignite/GridTestIoUtils.java
@@ -123,7 +123,7 @@ public final class GridTestIoUtils {
      * @throws Exception If failed.
      */
     @SuppressWarnings("unchecked")
-    public static <T> T externalize(Externalizable obj, IgniteMarshaller marshaller) throws Exception {
+    public static <T> T externalize(Externalizable obj, Marshaller marshaller) throws Exception {
         assert marshaller != null;
 
         byte[] buf = marshaller.marshal(obj);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5674cdde/modules/core/src/test/java/org/apache/ignite/IgniteExternalizableAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/IgniteExternalizableAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/IgniteExternalizableAbstractTest.java
index 77361bc..9ef7e98 100644
--- a/modules/core/src/test/java/org/apache/ignite/IgniteExternalizableAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/IgniteExternalizableAbstractTest.java
@@ -31,11 +31,11 @@ public class IgniteExternalizableAbstractTest extends GridCommonAbstractTest {
     /**
      * @return Marshallers.
      */
-    protected List<IgniteMarshaller> getMarshallers() {
-        List<IgniteMarshaller> marshallers = new ArrayList<>();
+    protected List<Marshaller> getMarshallers() {
+        List<Marshaller> marshallers = new ArrayList<>();
 
-        marshallers.add(new IgniteJdkMarshaller());
-        marshallers.add(new IgniteOptimizedMarshaller());
+        marshallers.add(new JdkMarshaller());
+        marshallers.add(new OptimizedMarshaller());
 
         return marshallers;
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5674cdde/modules/core/src/test/java/org/apache/ignite/ignitefs/GridGgfsPathSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/ignitefs/GridGgfsPathSelfTest.java b/modules/core/src/test/java/org/apache/ignite/ignitefs/GridGgfsPathSelfTest.java
index f9c3464..ec79356 100644
--- a/modules/core/src/test/java/org/apache/ignite/ignitefs/GridGgfsPathSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/ignitefs/GridGgfsPathSelfTest.java
@@ -35,7 +35,7 @@ import java.util.concurrent.*;
  */
 public class GridGgfsPathSelfTest extends GridCommonAbstractTest {
     /** Marshaller to test {@link Externalizable} interface. */
-    private final IgniteMarshaller marshaller = new IgniteOptimizedMarshaller();
+    private final Marshaller marshaller = new OptimizedMarshaller();
 
     /**
      * Test public methods of ggfs path.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5674cdde/modules/core/src/test/java/org/apache/ignite/internal/GridFailoverTaskWithPredicateSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridFailoverTaskWithPredicateSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridFailoverTaskWithPredicateSelfTest.java
index fd8fe97..bc142a3 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridFailoverTaskWithPredicateSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridFailoverTaskWithPredicateSelfTest.java
@@ -77,7 +77,7 @@ public class GridFailoverTaskWithPredicateSelfTest extends GridCommonAbstractTes
             }
         });
 
-        cfg.setMarshaller(new IgniteOptimizedMarshaller(false));
+        cfg.setMarshaller(new OptimizedMarshaller(false));
 
         return cfg;
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5674cdde/modules/core/src/test/java/org/apache/ignite/internal/GridJobMasterLeaveAwareSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridJobMasterLeaveAwareSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridJobMasterLeaveAwareSelfTest.java
index 09de917..eb012b6 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridJobMasterLeaveAwareSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridJobMasterLeaveAwareSelfTest.java
@@ -90,7 +90,7 @@ public class GridJobMasterLeaveAwareSelfTest extends GridCommonAbstractTest {
         cfg.setDiscoverySpi(discoSpi);
 
         cfg.setCommunicationSpi(new CommunicationSpi());
-        cfg.setMarshaller(new IgniteOptimizedMarshaller(false));
+        cfg.setMarshaller(new OptimizedMarshaller(false));
 
         CacheConfiguration ccfg = defaultCacheConfiguration();
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5674cdde/modules/core/src/test/java/org/apache/ignite/internal/GridJobStealingSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridJobStealingSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridJobStealingSelfTest.java
index 13f4910..477db7f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridJobStealingSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridJobStealingSelfTest.java
@@ -290,7 +290,7 @@ public class GridJobStealingSelfTest extends GridCommonAbstractTest {
         cfg.setCollisionSpi(colSpi);
         cfg.setFailoverSpi(failSpi);
 
-        cfg.setMarshaller(new IgniteOptimizedMarshaller(false));
+        cfg.setMarshaller(new OptimizedMarshaller(false));
 
         return cfg;
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5674cdde/modules/core/src/test/java/org/apache/ignite/internal/GridLifecycleAwareSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridLifecycleAwareSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridLifecycleAwareSelfTest.java
index 96aa496..6ac358a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridLifecycleAwareSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridLifecycleAwareSelfTest.java
@@ -101,7 +101,7 @@ public class GridLifecycleAwareSelfTest extends GridAbstractLifecycleAwareSelfTe
 
     /**
      */
-    private static class TestMarshaller extends IgniteOptimizedMarshaller implements LifecycleAware {
+    private static class TestMarshaller extends OptimizedMarshaller implements LifecycleAware {
         /** */
         private final TestLifecycleAware lifecycleAware = new TestLifecycleAware(null);
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5674cdde/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionLocalJobMultipleArgumentsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionLocalJobMultipleArgumentsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionLocalJobMultipleArgumentsSelfTest.java
index b96055a..79fcdbc 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionLocalJobMultipleArgumentsSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionLocalJobMultipleArgumentsSelfTest.java
@@ -56,7 +56,7 @@ public class GridProjectionLocalJobMultipleArgumentsSelfTest extends GridCommonA
     @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(gridName);
 
-        cfg.setMarshaller(new IgniteOptimizedMarshaller(false));
+        cfg.setMarshaller(new OptimizedMarshaller(false));
 
         CacheConfiguration cache = defaultCacheConfiguration();
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5674cdde/modules/core/src/test/java/org/apache/ignite/internal/GridTaskExecutionContextSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridTaskExecutionContextSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridTaskExecutionContextSelfTest.java
index 1706a16..01fcdf6 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridTaskExecutionContextSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridTaskExecutionContextSelfTest.java
@@ -43,7 +43,7 @@ public class GridTaskExecutionContextSelfTest extends GridCommonAbstractTest {
     @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(gridName);
 
-        cfg.setMarshaller(new IgniteOptimizedMarshaller(false));
+        cfg.setMarshaller(new OptimizedMarshaller(false));
 
         return cfg;
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5674cdde/modules/core/src/test/java/org/apache/ignite/internal/GridTopicExternalizableSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridTopicExternalizableSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridTopicExternalizableSelfTest.java
index 9d97559..7a90e6d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridTopicExternalizableSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridTopicExternalizableSelfTest.java
@@ -47,7 +47,7 @@ public class GridTopicExternalizableSelfTest extends IgniteExternalizableAbstrac
      * @throws Exception If failed.
      */
     public void testSerializationTopicCreatedByGridUuid() throws Exception {
-        for (IgniteMarshaller marsh : getMarshallers()) {
+        for (Marshaller marsh : getMarshallers()) {
             info("Test GridTopic externalization [marshaller=" + marsh + ']');
 
             for (GridTopic topic : GridTopic.values()) {
@@ -62,7 +62,7 @@ public class GridTopicExternalizableSelfTest extends IgniteExternalizableAbstrac
      * @throws Exception If failed.
      */
     public void testSerializationTopicCreatedByGridUuidAndUUID() throws Exception {
-        for (IgniteMarshaller marsh : getMarshallers()) {
+        for (Marshaller marsh : getMarshallers()) {
             info("Test GridTopic externalization [marshaller=" + marsh + ']');
 
             for (GridTopic topic : GridTopic.values()) {
@@ -77,7 +77,7 @@ public class GridTopicExternalizableSelfTest extends IgniteExternalizableAbstrac
      * @throws Exception If failed.
      */
     public void testSerializationTopicCreatedByGridUuidAndLong() throws Exception {
-        for (IgniteMarshaller marsh : getMarshallers()) {
+        for (Marshaller marsh : getMarshallers()) {
             info("Test GridTopic externalization [marshaller=" + marsh + ']');
 
             for (GridTopic topic : GridTopic.values()) {
@@ -92,7 +92,7 @@ public class GridTopicExternalizableSelfTest extends IgniteExternalizableAbstrac
      * @throws Exception If failed.
      */
     public void testSerializationTopicCreatedByStringAndUUIDAndLong() throws Exception {
-        for (IgniteMarshaller marsh : getMarshallers()) {
+        for (Marshaller marsh : getMarshallers()) {
             info("Test GridTopic externalization [marshaller=" + marsh + ']');
 
             for (GridTopic topic : GridTopic.values()) {
@@ -107,7 +107,7 @@ public class GridTopicExternalizableSelfTest extends IgniteExternalizableAbstrac
      * @throws Exception If failed.
      */
     public void testSerializationTopicCreatedByString() throws Exception {
-        for (IgniteMarshaller marsh : getMarshallers()) {
+        for (Marshaller marsh : getMarshallers()) {
             info("Test GridTopic externalization [marshaller=" + marsh + ']');
 
             for (GridTopic topic : GridTopic.values()) {
@@ -122,7 +122,7 @@ public class GridTopicExternalizableSelfTest extends IgniteExternalizableAbstrac
      * @throws Exception If failed.
      */
     public void testSerializationTopicCreatedByStringAndIntAndLong() throws Exception {
-        for (IgniteMarshaller marsh : getMarshallers()) {
+        for (Marshaller marsh : getMarshallers()) {
             info("Test GridTopic externalization [marshaller=" + marsh + ']');
 
             for (GridTopic topic : GridTopic.values()) {
@@ -137,7 +137,7 @@ public class GridTopicExternalizableSelfTest extends IgniteExternalizableAbstrac
      * @throws Exception If failed.
      */
     public void testSerializationTopicCreatedByStrinAndLong() throws Exception {
-        for (IgniteMarshaller marsh : getMarshallers()) {
+        for (Marshaller marsh : getMarshallers()) {
             info("Test GridTopic externalization [marshaller=" + marsh + ']');
 
             for (GridTopic topic : GridTopic.values()) {
@@ -152,7 +152,7 @@ public class GridTopicExternalizableSelfTest extends IgniteExternalizableAbstrac
      * @throws Exception If failed.
      */
     public void testSerializationTopicCreatedByStringAndUUIDAndIntAndLong() throws Exception {
-        for (IgniteMarshaller marsh : getMarshallers()) {
+        for (Marshaller marsh : getMarshallers()) {
             info("Test GridTopic externalization [marshaller=" + marsh + ']');
 
             for (GridTopic topic : GridTopic.values()) {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5674cdde/modules/core/src/test/java/org/apache/ignite/internal/IgniteComputeEmptyClusterGroupTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/IgniteComputeEmptyClusterGroupTest.java b/modules/core/src/test/java/org/apache/ignite/internal/IgniteComputeEmptyClusterGroupTest.java
index 9e1a5fa..42e500b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/IgniteComputeEmptyClusterGroupTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/IgniteComputeEmptyClusterGroupTest.java
@@ -51,7 +51,7 @@ public class IgniteComputeEmptyClusterGroupTest extends GridCommonAbstractTest {
 
         cfg.setDiscoverySpi(discoSpi);
 
-        cfg.setMarshaller(new IgniteOptimizedMarshaller(false));
+        cfg.setMarshaller(new OptimizedMarshaller(false));
 
         CacheConfiguration ccfg = defaultCacheConfiguration();
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5674cdde/modules/core/src/test/java/org/apache/ignite/internal/managers/GridManagerStopSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/managers/GridManagerStopSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/managers/GridManagerStopSelfTest.java
index 7521e37..40a6192 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/managers/GridManagerStopSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/managers/GridManagerStopSelfTest.java
@@ -124,7 +124,7 @@ public class GridManagerStopSelfTest extends GridCommonAbstractTest {
         injectLogger(spi);
 
         ctx.config().setCommunicationSpi(spi);
-        ctx.config().setMarshaller(new IgniteOptimizedMarshaller());
+        ctx.config().setMarshaller(new OptimizedMarshaller());
 
         GridIoManager mgr = new GridIoManager(ctx);
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5674cdde/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/GridIoManagerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/GridIoManagerSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/GridIoManagerSelfTest.java
index 1d29e2a..79100d2 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/GridIoManagerSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/GridIoManagerSelfTest.java
@@ -57,7 +57,7 @@ public class GridIoManagerSelfTest extends GridCommonAbstractTest {
     /** {@inheritDoc} */
     @Override protected void beforeTest() throws Exception {
         ctx.config().setCommunicationSpi(new TcpCommunicationSpi());
-        ctx.config().setMarshaller(new IgniteJdkMarshaller());
+        ctx.config().setMarshaller(new JdkMarshaller());
 
         // Turn off peer class loading to simplify mocking.
         ctx.config().setPeerClassLoadingEnabled(false);


Mime
View raw message