ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject [31/50] [abbrv] ignite git commit: IGNITE-2649 - Ignition.localIgnite() unreliable under Gateways and cause wrong components deserialization.
Date Wed, 24 Aug 2016 14:04:54 GMT
IGNITE-2649 - Ignition.localIgnite() unreliable under Gateways and cause wrong components deserialization.


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

Branch: refs/heads/ignite-2649
Commit: 63210e6d540604915371c35ca66d69339bb37370
Parents: 97ce8fb
Author: dkarachentsev <dkarachentsev@gridgain.com>
Authored: Wed Aug 3 17:51:10 2016 +0300
Committer: dkarachentsev <dkarachentsev@gridgain.com>
Committed: Wed Aug 3 17:51:10 2016 +0300

----------------------------------------------------------------------
 .../socket/WordsSocketStreamerServer.java       |   2 +-
 .../rest/protocols/tcp/MockNioSession.java      |   2 +-
 .../rendezvous/RendezvousAffinityFunction.java  |   2 +-
 .../cache/store/jdbc/CacheJdbcBlobStore.java    |   4 +-
 .../org/apache/ignite/internal/IgnitionEx.java  |  10 +-
 .../internal/binary/BinaryEnumObjectImpl.java   |   2 +-
 .../internal/binary/BinaryObjectImpl.java       |  17 +-
 .../internal/binary/BinaryReaderExImpl.java     |  25 ++
 .../internal/binary/BinaryWriterExImpl.java     |  21 +-
 .../connection/GridClientNioTcpConnection.java  |   2 +-
 .../router/impl/GridTcpRouterNioParser.java     |   2 +-
 .../jdbc/GridCacheQueryJdbcMetadataTask.java    |   4 +-
 .../query/jdbc/GridCacheQueryJdbcTask.java      |   6 +-
 .../rest/protocols/tcp/GridTcpRestParser.java   |  30 +-
 .../internal/util/ipc/IpcToNioAdapter.java      |   6 +-
 .../ignite/internal/util/nio/GridNioServer.java |   6 +-
 .../internal/util/nio/GridNioSession.java       |   4 +-
 .../internal/util/nio/GridNioSessionImpl.java   |  14 +-
 .../util/nio/GridSelectorNioSessionImpl.java    |   6 +-
 .../ignite/marshaller/MarshallerUtils.java      |  37 ---
 .../communication/tcp/TcpCommunicationSpi.java  |   2 +-
 .../ignite/spi/discovery/tcp/ClientImpl.java    |   6 +-
 .../ignite/spi/discovery/tcp/ServerImpl.java    |  26 +-
 .../spi/discovery/tcp/TcpDiscoverySpi.java      |   4 +-
 .../TcpDiscoveryMulticastIpFinder.java          |  31 +-
 .../TcpDiscoveryCustomEventMessage.java         |  12 +-
 .../spi/swapspace/file/FileSwapSpaceSpi.java    |   2 +-
 .../stream/socket/SocketMessageConverter.java   |   6 +-
 .../ignite/stream/socket/SocketStreamer.java    |   6 +-
 .../GridBinaryCacheSerializationTest.java       | 299 +++++++++++++++++--
 .../nio/impl/GridNioFilterChainSelfTest.java    |   2 +-
 .../stream/socket/SocketStreamerSelfTest.java   |   4 +-
 .../HadoopExternalCommunication.java            |   5 +-
 .../communication/HadoopIpcToNioAdapter.java    |   6 +-
 .../communication/HadoopMarshallerFilter.java   |   4 +-
 .../cache/websession/WebSessionFilter.java      |   8 +-
 .../ignite/cache/websession/WebSessionV2.java   |  13 +-
 37 files changed, 439 insertions(+), 199 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/63210e6d/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/socket/WordsSocketStreamerServer.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/socket/WordsSocketStreamerServer.java b/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/socket/WordsSocketStreamerServer.java
index c1727a55..a9eef7f 100644
--- a/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/socket/WordsSocketStreamerServer.java
+++ b/examples/src/main/java/org/apache/ignite/examples/streaming/wordcount/socket/WordsSocketStreamerServer.java
@@ -100,7 +100,7 @@ public class WordsSocketStreamerServer {
 
         // Converter from zero-terminated string to Java strings.
         sockStmr.setConverter(new SocketMessageConverter<String>() {
-            @Override public String convert(byte[] msg, IgniteConfiguration cfg) {
+            @Override public String convert(byte[] msg, String gridName) {
                 try {
                     return new String(msg, "ASCII");
                 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/63210e6d/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/protocols/tcp/MockNioSession.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/protocols/tcp/MockNioSession.java b/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/protocols/tcp/MockNioSession.java
index e4efc78..737f5a9 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/protocols/tcp/MockNioSession.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/protocols/tcp/MockNioSession.java
@@ -143,7 +143,7 @@ public class MockNioSession extends GridMetadataAwareAdapter implements GridNioS
     }
 
     /** {@inheritDoc} */
-    @Override public IgniteConfiguration igniteConfiguration() {
+    @Override public String gridName() {
         return null;
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/63210e6d/modules/core/src/main/java/org/apache/ignite/cache/affinity/rendezvous/RendezvousAffinityFunction.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/affinity/rendezvous/RendezvousAffinityFunction.java b/modules/core/src/main/java/org/apache/ignite/cache/affinity/rendezvous/RendezvousAffinityFunction.java
index 8a84e9f..b60d806 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/affinity/rendezvous/RendezvousAffinityFunction.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/affinity/rendezvous/RendezvousAffinityFunction.java
@@ -338,7 +338,7 @@ public class RendezvousAffinityFunction implements AffinityFunction, Externaliza
                 ByteArrayOutputStream out = new ByteArrayOutputStream();
 
                 byte[] nodeHashBytes = MarshallerUtils.marshal(
-                        ignite.configuration().getMarshaller(), nodeHash, ignite.configuration());
+                        ignite.configuration().getMarshaller(), nodeHash, ignite.name());
 
                 out.write(U.intToBytes(part), 0, 4); // Avoid IOException.
                 out.write(nodeHashBytes, 0, nodeHashBytes.length); // Avoid IOException.

http://git-wip-us.apache.org/repos/asf/ignite/blob/63210e6d/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcBlobStore.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcBlobStore.java b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcBlobStore.java
index d34adda..e641736 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcBlobStore.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/CacheJdbcBlobStore.java
@@ -561,7 +561,7 @@ public class CacheJdbcBlobStore<K, V> extends CacheStoreAdapter<K, V> {
      * @throws IgniteCheckedException If failed to convert.
      */
     protected byte[] toBytes(Object obj) throws IgniteCheckedException {
-        return MarshallerUtils.marshal(marsh, obj, ignite.configuration());
+        return MarshallerUtils.marshal(marsh, obj, ignite.name());
     }
 
     /**
@@ -576,7 +576,7 @@ public class CacheJdbcBlobStore<K, V> extends CacheStoreAdapter<K, V> {
         if (bytes == null || bytes.length == 0)
             return null;
 
-        return MarshallerUtils.unmarshal(marsh, bytes, getClass().getClassLoader(), ignite.configuration());
+        return MarshallerUtils.unmarshal(marsh, bytes, getClass().getClassLoader(), ignite.name());
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/63210e6d/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java b/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
index 8f882ef..fe9dab0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
@@ -1289,12 +1289,16 @@ public class IgnitionEx {
      * @throws IllegalArgumentException Thrown to indicate, that current thread is not an {@link IgniteThread}.
      */
     public static IgniteKernal localIgnite() throws IllegalArgumentException {
-        if (GRID_NAME_THREAD_LOC.get() != null)
-            return gridx(GRID_NAME_THREAD_LOC.get());
+        final String gridName = GRID_NAME_THREAD_LOC.get();
+
+        // TODO support null!!
+
+        if (gridName != null)
+            return gridx(gridName);
         else if (Thread.currentThread() instanceof IgniteThread)
             return gridx(((IgniteThread)Thread.currentThread()).getGridName());
         else
-            throw new IllegalArgumentException("Ignite conf thread local must be set or" +
+            throw new IllegalArgumentException("Ignite grid name thread local must be set or" +
                     " this method should be accessed under " + IgniteThread.class.getName());
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/63210e6d/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryEnumObjectImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryEnumObjectImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryEnumObjectImpl.java
index 489220e..aa415eb 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryEnumObjectImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryEnumObjectImpl.java
@@ -244,7 +244,7 @@ public class BinaryEnumObjectImpl implements BinaryObjectEx, Externalizable, Cac
 
     /** {@inheritDoc} */
     @Override public byte[] valueBytes(CacheObjectContext cacheCtx) throws IgniteCheckedException {
-        return MarshallerUtils.marshal(ctx.marshaller(), this, ctx.configuration());
+        return MarshallerUtils.marshal(ctx.marshaller(), this, ctx.configuration().getGridName());
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/63210e6d/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectImpl.java
index 2296a3d..047bcac 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectImpl.java
@@ -21,7 +21,6 @@ import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.binary.BinaryObject;
 import org.apache.ignite.binary.BinaryObjectException;
 import org.apache.ignite.binary.BinaryType;
-import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.internal.GridDirectTransient;
 import org.apache.ignite.internal.IgniteCodeGeneratingFail;
 import org.apache.ignite.internal.IgnitionEx;
@@ -540,18 +539,8 @@ public final class BinaryObjectImpl extends BinaryObjectExImpl implements Extern
      * @return Object.
      */
     private Object deserializeValue(@Nullable CacheObjectContext coCtx) {
-        final String gridName = IgnitionEx.getGridNameThreadLocal();
-
-        final ClassLoader cl;
-
-        if (coCtx != null) {
-            IgnitionEx.setGridNameThreadLocal(coCtx.kernalContext().config().getGridName());
-
-            cl = coCtx.kernalContext().config().getClassLoader();
-        } else
-            cl = ctx.configuration().getClassLoader();
-
-        final BinaryReaderExImpl reader = reader(null, cl);
+        BinaryReaderExImpl reader = reader(null,
+            coCtx != null ? coCtx.kernalContext().config().getClassLoader() : ctx.configuration().getClassLoader());
 
         Object obj0 = reader.deserialize();
 
@@ -562,8 +551,6 @@ public final class BinaryObjectImpl extends BinaryObjectExImpl implements Extern
         if (coCtx != null && coCtx.storeValue())
             obj = obj0;
 
-        IgnitionEx.setGridNameThreadLocal(gridName);
-
         return obj0;
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/63210e6d/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryReaderExImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryReaderExImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryReaderExImpl.java
index 9e7a1b3..44cf85e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryReaderExImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryReaderExImpl.java
@@ -33,6 +33,7 @@ import org.apache.ignite.binary.BinaryObject;
 import org.apache.ignite.binary.BinaryObjectException;
 import org.apache.ignite.binary.BinaryRawReader;
 import org.apache.ignite.binary.BinaryReader;
+import org.apache.ignite.internal.IgnitionEx;
 import org.apache.ignite.internal.binary.streams.BinaryInputStream;
 import org.apache.ignite.internal.util.typedef.internal.SB;
 import org.jetbrains.annotations.NotNull;
@@ -1420,6 +1421,23 @@ public class BinaryReaderExImpl implements BinaryReader, BinaryRawReaderEx, Bina
      * @throws BinaryObjectException If failed.
      */
     @Nullable Object deserialize() throws BinaryObjectException {
+        final String gridName = IgnitionEx.getGridNameThreadLocal();
+
+        try {
+            IgnitionEx.setGridNameThreadLocal(ctx.configuration().getGridName());
+
+            return deserialize0();
+        }
+        finally {
+            IgnitionEx.setGridNameThreadLocal(gridName);
+        }
+    }
+
+    /**
+     * @return Deserialized object.
+     * @throws BinaryObjectException If failed.
+     */
+    @Nullable private Object deserialize0() throws BinaryObjectException {
         Object obj;
 
         byte flag = in.readByte();
@@ -2028,6 +2046,13 @@ public class BinaryReaderExImpl implements BinaryReader, BinaryRawReaderEx, Bina
     }
 
     /**
+     * @return Binary context.
+     */
+    public BinaryContext context() {
+        return ctx;
+    }
+
+    /**
      * Flag.
      */
     private enum Flag {

http://git-wip-us.apache.org/repos/asf/ignite/blob/63210e6d/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryWriterExImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryWriterExImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryWriterExImpl.java
index fab379a..9bf7ecb 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryWriterExImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryWriterExImpl.java
@@ -33,6 +33,7 @@ import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.binary.BinaryObjectException;
 import org.apache.ignite.binary.BinaryRawWriter;
 import org.apache.ignite.binary.BinaryWriter;
+import org.apache.ignite.internal.IgnitionEx;
 import org.apache.ignite.internal.binary.streams.BinaryHeapOutputStream;
 import org.apache.ignite.internal.binary.streams.BinaryOutputStream;
 import org.apache.ignite.internal.util.typedef.internal.A;
@@ -139,6 +140,24 @@ public class BinaryWriterExImpl implements BinaryWriter, BinaryRawWriterEx, Obje
      * @throws org.apache.ignite.binary.BinaryObjectException In case of error.
      */
     void marshal(Object obj, boolean enableReplace) throws BinaryObjectException {
+        final String gridName = IgnitionEx.getGridNameThreadLocal();
+
+        try {
+            IgnitionEx.setGridNameThreadLocal(ctx.configuration().getGridName());
+
+            marshal0(obj, enableReplace);
+        }
+        finally {
+            IgnitionEx.setGridNameThreadLocal(gridName);
+        }
+    }
+
+    /**
+     * @param obj Object.
+     * @param enableReplace Object replacing enabled flag.
+     * @throws org.apache.ignite.binary.BinaryObjectException In case of error.
+     */
+    private void marshal0(Object obj, boolean enableReplace) throws BinaryObjectException {
         assert obj != null;
 
         Class<?> cls = obj.getClass();
@@ -158,7 +177,7 @@ public class BinaryWriterExImpl implements BinaryWriter, BinaryRawWriterEx, Obje
             out.writeByte(GridBinaryMarshaller.OPTM_MARSH);
 
             try {
-                byte[] arr = MarshallerUtils.marshal(ctx.optimizedMarsh(), obj, ctx.configuration());
+                byte[] arr = MarshallerUtils.marshal(ctx.optimizedMarsh(), obj, ctx.configuration().getGridName());
 
                 writeInt(arr.length);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/63210e6d/modules/core/src/main/java/org/apache/ignite/internal/client/impl/connection/GridClientNioTcpConnection.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/impl/connection/GridClientNioTcpConnection.java b/modules/core/src/main/java/org/apache/ignite/internal/client/impl/connection/GridClientNioTcpConnection.java
index c91f085..579d185 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/client/impl/connection/GridClientNioTcpConnection.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/client/impl/connection/GridClientNioTcpConnection.java
@@ -541,7 +541,7 @@ public class GridClientNioTcpConnection extends GridClientConnection {
 
             if (res instanceof GridRouterResponse) {
                 res0 = MarshallerUtils.unmarshal(marsh, ((GridRouterResponse)res).body(),
-                    ses.igniteConfiguration().getGridName());
+                    ses.gridName());
 
                 res0.requestId(res.requestId());
                 res0.clientId(res.clientId());

http://git-wip-us.apache.org/repos/asf/ignite/blob/63210e6d/modules/core/src/main/java/org/apache/ignite/internal/client/router/impl/GridTcpRouterNioParser.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/router/impl/GridTcpRouterNioParser.java b/modules/core/src/main/java/org/apache/ignite/internal/client/router/impl/GridTcpRouterNioParser.java
index 77b9f82..0b3a042 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/client/router/impl/GridTcpRouterNioParser.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/client/router/impl/GridTcpRouterNioParser.java
@@ -86,7 +86,7 @@ class GridTcpRouterNioParser extends GridTcpRestParser {
 
             GridClientMessage clientMsg = (GridClientMessage)msg;
 
-            ByteBuffer res = MarshallerUtils.marshal(marsh, msg, 45, ses.igniteConfiguration().getGridName());
+            ByteBuffer res = MarshallerUtils.marshal(marsh, msg, 45, ses.gridName());
 
             ByteBuffer slice = res.slice();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/63210e6d/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 ec242f1..9d4fb7d 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
@@ -154,7 +154,7 @@ public class GridCacheQueryJdbcMetadataTask extends ComputeTaskAdapter<String, b
 
                 status = 0;
 
-                data = MarshallerUtils.marshal(MARSHALLER, F.asList(schemasMap, indexesInfo), ignite.configuration());
+                data = MarshallerUtils.marshal(MARSHALLER, F.asList(schemasMap, indexesInfo), ignite.name());
             }
             catch (Throwable t) {
                 U.error(log, "Failed to get metadata for JDBC.", t);
@@ -164,7 +164,7 @@ public class GridCacheQueryJdbcMetadataTask extends ComputeTaskAdapter<String, b
                 status = 1;
 
                 try {
-                    data = MarshallerUtils.marshal(MARSHALLER, err, ignite.configuration());
+                    data = MarshallerUtils.marshal(MARSHALLER, err, ignite.name());
                 }
                 catch (IgniteCheckedException e) {
                     throw new IgniteException(e);

http://git-wip-us.apache.org/repos/asf/ignite/blob/63210e6d/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 3faca1b..d078f38 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
@@ -83,7 +83,7 @@ public class GridCacheQueryJdbcTask extends ComputeTaskAdapter<byte[], byte[]> {
         try {
             assert arg != null;
 
-            Map<String, Object> args = MarshallerUtils.unmarshal(MARSHALLER, arg, null, ignite.configuration());
+            Map<String, Object> args = MarshallerUtils.unmarshal(MARSHALLER, arg, null, ignite.name());
 
             boolean first = true;
 
@@ -131,13 +131,13 @@ public class GridCacheQueryJdbcTask extends ComputeTaskAdapter<byte[], byte[]> {
             if (res.getException() == null) {
                 status = 0;
 
-                bytes = MarshallerUtils.marshal(MARSHALLER, res.getData(), ignite.configuration());
+                bytes = MarshallerUtils.marshal(MARSHALLER, res.getData(), ignite.name());
             }
             else {
                 status = 1;
 
                 bytes = MarshallerUtils.marshal(MARSHALLER, new SQLException(res.getException().getMessage()),
-                        ignite.configuration());
+                        ignite.name());
             }
 
             byte[] packet = new byte[bytes.length + 1];

http://git-wip-us.apache.org/repos/asf/ignite/blob/63210e6d/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridTcpRestParser.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridTcpRestParser.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridTcpRestParser.java
index 21f105d..4e44abe 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridTcpRestParser.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridTcpRestParser.java
@@ -171,7 +171,7 @@ public class GridTcpRestParser implements GridNioParser {
         GridClientMessage msg = (GridClientMessage)msg0;
 
         if (msg instanceof GridMemcachedMessage)
-            return encodeMemcache((GridMemcachedMessage)msg, ses.igniteConfiguration());
+            return encodeMemcache((GridMemcachedMessage)msg, ses.gridName());
         else if (msg instanceof GridClientPingPacket)
             return ByteBuffer.wrap(GridClientPingPacket.PING_PACKET);
         else if (msg instanceof GridClientHandshakeRequest) {
@@ -210,7 +210,7 @@ public class GridTcpRestParser implements GridNioParser {
         else {
             GridClientMarshaller marsh = marshaller(ses);
 
-            ByteBuffer res = MarshallerUtils.marshal(marsh, msg, 45, ses.igniteConfiguration().getGridName());
+            ByteBuffer res = MarshallerUtils.marshal(marsh, msg, 45, ses.gridName());
 
             ByteBuffer slice = res.slice();
 
@@ -522,7 +522,7 @@ public class GridTcpRestParser implements GridNioParser {
             GridClientMarshaller marsh = marshaller(ses);
 
             msg = MarshallerUtils.unmarshal(marsh, state.buffer().toByteArray(),
-                ses.igniteConfiguration().getGridName());
+                ses.gridName());
 
             msg.requestId(state.header().reqId());
             msg.clientId(state.header().clientId());
@@ -536,12 +536,12 @@ public class GridTcpRestParser implements GridNioParser {
      * Encodes memcache message to a raw byte array.
      *
      * @param msg Message being serialized.
-     * @param igniteCfg Ignite config.
+     * @param gridName Grid name.
      * @return Serialized message.
      * @throws IgniteCheckedException If serialization failed.
      */
     private ByteBuffer encodeMemcache(GridMemcachedMessage msg,
-        final IgniteConfiguration igniteCfg) throws IgniteCheckedException {
+        final String gridName) throws IgniteCheckedException {
         GridByteArrayList res = new GridByteArrayList(HDR_LEN);
 
         int keyLen = 0;
@@ -551,7 +551,7 @@ public class GridTcpRestParser implements GridNioParser {
         if (msg.key() != null) {
             ByteArrayOutputStream rawKey = new ByteArrayOutputStream();
 
-            keyFlags = encodeObj(msg.key(), rawKey, igniteCfg);
+            keyFlags = encodeObj(msg.key(), rawKey, gridName);
 
             msg.key(rawKey.toByteArray());
 
@@ -565,7 +565,7 @@ public class GridTcpRestParser implements GridNioParser {
         if (msg.value() != null) {
             ByteArrayOutputStream rawVal = new ByteArrayOutputStream();
 
-            valFlags = encodeObj(msg.value(), rawVal, igniteCfg);
+            valFlags = encodeObj(msg.value(), rawVal, gridName);
 
             msg.value(rawVal.toByteArray());
 
@@ -650,7 +650,7 @@ public class GridTcpRestParser implements GridNioParser {
                 byte[] rawKey = (byte[])req.key();
 
                 // Only values can be hessian-encoded.
-                req.key(decodeObj(keyFlags, rawKey, ses.igniteConfiguration()));
+                req.key(decodeObj(keyFlags, rawKey, ses.gridName()));
             }
 
             if (req.value() != null) {
@@ -658,7 +658,7 @@ public class GridTcpRestParser implements GridNioParser {
 
                 byte[] rawVal = (byte[])req.value();
 
-                req.value(decodeObj(valFlags, rawVal, ses.igniteConfiguration()));
+                req.value(decodeObj(valFlags, rawVal, ses.gridName()));
             }
         }
 
@@ -716,16 +716,16 @@ public class GridTcpRestParser implements GridNioParser {
      *
      * @param flags Flags.
      * @param bytes Byte array to decode.
-     * @param igniteCfg Ignite config.
+     * @param gridName Grid name.
      * @return Decoded value.
      * @throws IgniteCheckedException If deserialization failed.
      */
     private Object decodeObj(short flags, byte[] bytes,
-        final IgniteConfiguration igniteCfg) throws IgniteCheckedException {
+        final String gridName) throws IgniteCheckedException {
         assert bytes != null;
 
         if ((flags & SERIALIZED_FLAG) != 0)
-            return MarshallerUtils.unmarshal(jdkMarshaller, bytes, null, igniteCfg);
+            return MarshallerUtils.unmarshal(jdkMarshaller, bytes, null, gridName);
 
         int masked = flags & 0xff00;
 
@@ -756,12 +756,12 @@ public class GridTcpRestParser implements GridNioParser {
      *
      * @param obj Object to serialize.
      * @param out Output stream to which object should be written.
-     * @param igniteCfg Ignite config.
+     * @param gridName Grid name.
      * @return Serialization flags.
      * @throws IgniteCheckedException If JDK serialization failed.
      */
     private int encodeObj(Object obj, ByteArrayOutputStream out,
-        final IgniteConfiguration igniteCfg) throws IgniteCheckedException {
+        final String gridName) throws IgniteCheckedException {
         int flags = 0;
 
         byte[] data = null;
@@ -809,7 +809,7 @@ public class GridTcpRestParser implements GridNioParser {
             flags |= BYTE_ARR_FLAG;
         }
         else {
-            MarshallerUtils.marshal(jdkMarshaller, obj, out, igniteCfg.getGridName());
+            MarshallerUtils.marshal(jdkMarshaller, obj, out, gridName);
 
             flags |= SERIALIZED_FLAG;
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/63210e6d/modules/core/src/main/java/org/apache/ignite/internal/util/ipc/IpcToNioAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/ipc/IpcToNioAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/util/ipc/IpcToNioAdapter.java
index 56d0c30..0063cff 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/ipc/IpcToNioAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/ipc/IpcToNioAdapter.java
@@ -74,12 +74,12 @@ public class IpcToNioAdapter<T> {
      * @param endp Endpoint.
      * @param lsnr Listener.
      * @param writerFactory Writer factory.
-     * @param igniteCfg Ignite config.
+     * @param gridName Grid name.
      * @param filters Filters.
      */
     public IpcToNioAdapter(GridNioMetricsListener metricsLsnr, IgniteLogger log, IpcEndpoint endp,
                            GridNioServerListener<T> lsnr, GridNioMessageWriterFactory writerFactory,
-                           IgniteConfiguration igniteCfg, GridNioFilter... filters) {
+                           String gridName, GridNioFilter... filters) {
         assert metricsLsnr != null;
 
         this.metricsLsnr = metricsLsnr;
@@ -87,7 +87,7 @@ public class IpcToNioAdapter<T> {
         this.writerFactory = writerFactory;
 
         chain = new GridNioFilterChain<>(log, lsnr, new HeadFilter(), filters);
-        ses = new GridNioSessionImpl(chain, null, null, true, igniteCfg);
+        ses = new GridNioSessionImpl(chain, null, null, true, gridName);
 
         writeBuf = ByteBuffer.allocate(8 << 10);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/63210e6d/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
index 3a2a98f..7470759 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
@@ -1635,10 +1635,6 @@ public class GridNioServer<T> {
                     readBuf.order(order);
                 }
 
-                final IgniteConfiguration cfg = new IgniteConfiguration(); // TODO provide real config
-
-                cfg.setGridName(gridName);
-
                 final GridSelectorNioSessionImpl ses = new GridSelectorNioSessionImpl(
                     log,
                     idx,
@@ -1649,7 +1645,7 @@ public class GridNioServer<T> {
                     sndQueueLimit,
                     writeBuf,
                     readBuf,
-                    cfg);
+                    gridName);
 
                 Map<Integer, ?> meta = req.meta();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/63210e6d/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioSession.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioSession.java b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioSession.java
index edc9aa6..766670a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioSession.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioSession.java
@@ -168,7 +168,7 @@ public interface GridNioSession {
     @Nullable public GridNioRecoveryDescriptor recoveryDescriptor();
 
     /**
-     * @return Ignite configuration.
+     * @return Grid name.
      */
-    public IgniteConfiguration igniteConfiguration();
+    public String gridName();
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/63210e6d/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioSessionImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioSessionImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioSessionImpl.java
index b1465c6..638732e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioSessionImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioSessionImpl.java
@@ -70,14 +70,14 @@ public class GridNioSessionImpl implements GridNioSession {
     /** Accepted flag. */
     private final boolean accepted;
 
-    /** Ignite configuration. */
-    private IgniteConfiguration igniteCfg;
+    /** Grid name. */
+    private String gridName;
 
     /**
      * @param filterChain Chain.
      * @param locAddr Local address.
      * @param rmtAddr Remote address.
-     * @param igniteCfg Ignite config.
+     * @param gridName Grid name.
      * @param accepted {@code True} if this session was initiated from remote host.
      */
     public GridNioSessionImpl(
@@ -85,13 +85,13 @@ public class GridNioSessionImpl implements GridNioSession {
         @Nullable InetSocketAddress locAddr,
         @Nullable InetSocketAddress rmtAddr,
         boolean accepted,
-        IgniteConfiguration igniteCfg
+        String gridName
     ) {
         this.filterChain = filterChain;
         this.locAddr = locAddr;
         this.rmtAddr = rmtAddr;
         this.accepted = accepted;
-        this.igniteCfg = igniteCfg;
+        this.gridName = gridName;
 
         long now = U.currentTimeMillis();
 
@@ -318,7 +318,7 @@ public class GridNioSessionImpl implements GridNioSession {
     }
 
     /** {@inheritDoc} */
-    @Override public IgniteConfiguration igniteConfiguration() {
-        return igniteCfg;
+    @Override public String gridName() {
+        return gridName;
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/63210e6d/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridSelectorNioSessionImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridSelectorNioSessionImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridSelectorNioSessionImpl.java
index 042eaee..db5fc18 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridSelectorNioSessionImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridSelectorNioSessionImpl.java
@@ -78,7 +78,7 @@ class GridSelectorNioSessionImpl extends GridNioSessionImpl {
      * @param sndQueueLimit Send queue limit.
      * @param writeBuf Write buffer.
      * @param readBuf Read buffer.
-     * @param igniteCfg Ignite config.
+     * @param gridName Grid name.
      */
     GridSelectorNioSessionImpl(
         IgniteLogger log,
@@ -90,9 +90,9 @@ class GridSelectorNioSessionImpl extends GridNioSessionImpl {
         int sndQueueLimit,
         @Nullable ByteBuffer writeBuf,
         @Nullable ByteBuffer readBuf,
-        IgniteConfiguration igniteCfg
+        String gridName
     ) {
-        super(filterChain, locAddr, rmtAddr, accepted, igniteCfg);
+        super(filterChain, locAddr, rmtAddr, accepted, gridName);
 
         assert selectorIdx >= 0;
         assert sndQueueLimit >= 0;

http://git-wip-us.apache.org/repos/asf/ignite/blob/63210e6d/modules/core/src/main/java/org/apache/ignite/marshaller/MarshallerUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/marshaller/MarshallerUtils.java b/modules/core/src/main/java/org/apache/ignite/marshaller/MarshallerUtils.java
index b6808e9..b678bd2 100644
--- a/modules/core/src/main/java/org/apache/ignite/marshaller/MarshallerUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/marshaller/MarshallerUtils.java
@@ -64,19 +64,6 @@ public final class MarshallerUtils {
      *
      * @param marshaller marshaller.
      * @param obj object.
-     * @param igniteCfg ignite config.
-     * @return serialized.
-     * @throws IgniteCheckedException
-     */
-    public static byte[] marshal(final Marshaller marshaller, @Nullable Object obj,
-        final IgniteConfiguration igniteCfg) throws IgniteCheckedException {
-        return marshal(marshaller, obj, igniteCfg.getGridName());
-    }
-
-    /**
-     *
-     * @param marshaller marshaller.
-     * @param obj object.
      * @param gridName Grid name.
      * @return serialized.
      * @throws IgniteCheckedException
@@ -137,21 +124,6 @@ public final class MarshallerUtils {
     /**
      *
      * @param marshaller marshaller.
-     * @param arr byte array.
-     * @param clsLdr class loader.
-     * @param igniteCfg ignite config.
-     * @param <T> target type
-     * @return deserialized object.
-     * @throws IgniteCheckedException
-     */
-    public static <T> T unmarshal(final Marshaller marshaller, byte[] arr, @Nullable ClassLoader clsLdr,
-        final IgniteConfiguration igniteCfg) throws IgniteCheckedException {
-        return unmarshal(marshaller, arr, clsLdr, igniteCfg.getGridName());
-    }
-
-    /**
-     *
-     * @param marshaller marshaller.
      * @param obj object
      * @param clsLdr class loader.
      * @param gridName Grid name.
@@ -229,13 +201,4 @@ public final class MarshallerUtils {
     private static void restoreGridName(final String name) {
         IgnitionEx.setGridNameThreadLocal(name);
     }
-
-    /**
-     *
-     * @param kernalCtx kernal context.
-     * @return ignite config or null.
-     */
-    private static IgniteConfiguration getConfig(final @Nullable GridKernalContext kernalCtx) {
-        return kernalCtx == null ? null : kernalCtx.config();
-    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/63210e6d/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
index 8e78352..5938db6 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
@@ -3013,7 +3013,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
                     endpoint,
                     srvLsnr,
                     writerFactory,
-                    ignite.configuration(),
+                    gridName,
                     new GridNioCodecFilter(new GridDirectParser(msgFactory, readerFactory), log, true),
                     new GridConnectionBytesVerifyFilter(log)
                 );

http://git-wip-us.apache.org/repos/asf/ignite/blob/63210e6d/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
index f383fe7..0a0b42d 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
@@ -431,7 +431,7 @@ class ClientImpl extends TcpDiscoveryImpl {
 
         try {
             sockWriter.sendMessage(new TcpDiscoveryCustomEventMessage(getLocalNodeId(), evt,
-                MarshallerUtils.marshal(spi.marsh, evt, spi.ignite().configuration())));
+                MarshallerUtils.marshal(spi.marsh, evt, spi.ignite().name())));
         }
         catch (IgniteCheckedException e) {
             throw new IgniteSpiException("Failed to marshal custom event: " + evt, e);
@@ -686,7 +686,7 @@ class ClientImpl extends TcpDiscoveryImpl {
 
             attrs.put(IgniteNodeAttributes.ATTR_SECURITY_CREDENTIALS,
                     MarshallerUtils.marshal(spi.marsh, attrs.get(IgniteNodeAttributes.ATTR_SECURITY_CREDENTIALS),
-                        spi.ignite().configuration()));
+                        spi.ignite().name()));
 
             node.setAttributes(attrs);
         }
@@ -1968,7 +1968,7 @@ class ClientImpl extends TcpDiscoveryImpl {
                     if (node != null && node.visible()) {
                         try {
                             DiscoverySpiCustomMessage msgObj = msg.message(spi.marsh,
-                                U.resolveClassLoader(spi.ignite().configuration()), spi.ignite().configuration());
+                                U.resolveClassLoader(spi.ignite().configuration()), spi.ignite().name());
 
                             notifyDiscovery(EVT_DISCOVERY_CUSTOM_EVT, topVer, node, allVisibleNodes(), msgObj);
                         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/63210e6d/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
index 3244182..d8dcca4 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
@@ -743,7 +743,7 @@ class ServerImpl extends TcpDiscoveryImpl {
     @Override public void sendCustomEvent(DiscoverySpiCustomMessage evt) {
         try {
             msgWorker.addMessage(new TcpDiscoveryCustomEventMessage(getLocalNodeId(), evt,
-                    MarshallerUtils.marshal(spi.marsh, evt, spi.ignite().configuration())));
+                    MarshallerUtils.marshal(spi.marsh, evt, spi.ignite().name())));
         }
         catch (IgniteCheckedException e) {
             throw new IgniteSpiException("Failed to marshal custom event: " + evt, e);
@@ -827,7 +827,7 @@ class ServerImpl extends TcpDiscoveryImpl {
                         Map<String, Object> attrs = new HashMap<>(locNode.attributes());
 
                         attrs.put(IgniteNodeAttributes.ATTR_SECURITY_SUBJECT,
-                            MarshallerUtils.marshal(spi.marsh, subj, spi.ignite().configuration()));
+                            MarshallerUtils.marshal(spi.marsh, subj, spi.ignite().name()));
                         attrs.remove(IgniteNodeAttributes.ATTR_SECURITY_CREDENTIALS);
 
                         locNode.setAttributes(attrs);
@@ -1244,7 +1244,7 @@ class ServerImpl extends TcpDiscoveryImpl {
 
             attrs.put(IgniteNodeAttributes.ATTR_SECURITY_CREDENTIALS,
                 MarshallerUtils.marshal(spi.marsh,
-                        attrs.get(IgniteNodeAttributes.ATTR_SECURITY_CREDENTIALS), spi.ignite().configuration()));
+                        attrs.get(IgniteNodeAttributes.ATTR_SECURITY_CREDENTIALS), spi.ignite().name()));
 
             node.setAttributes(attrs);
         }
@@ -1267,7 +1267,7 @@ class ServerImpl extends TcpDiscoveryImpl {
             if (credBytes == null)
                 return null;
 
-            return MarshallerUtils.unmarshal(spi.marsh, credBytes, null, spi.ignite().configuration());
+            return MarshallerUtils.unmarshal(spi.marsh, credBytes, null, spi.ignite().name());
         }
         catch (IgniteCheckedException e) {
             throw new IgniteSpiException("Failed to unmarshal node security credentials: " + node.id(), e);
@@ -2361,7 +2361,7 @@ class ServerImpl extends TcpDiscoveryImpl {
                 for (ClientMessageWorker clientMsgWorker : clientMsgWorkers.values()) {
                     if (msgBytes == null) {
                         try {
-                            msgBytes = MarshallerUtils.marshal(spi.marsh, msg, spi.ignite().configuration());
+                            msgBytes = MarshallerUtils.marshal(spi.marsh, msg, spi.ignite().name());
                         }
                         catch (IgniteCheckedException e) {
                             U.error(log, "Failed to marshal message: " + msg, e);
@@ -2381,7 +2381,7 @@ class ServerImpl extends TcpDiscoveryImpl {
                         if (clientMsgWorker.clientNodeId.equals(node.id())) {
                             try {
                                 msg0 = MarshallerUtils.unmarshal(spi.marsh, msgBytes,
-                                    U.resolveClassLoader(spi.ignite().configuration()), spi.ignite().configuration());
+                                    U.resolveClassLoader(spi.ignite().configuration()), spi.ignite().name());
 
                                 prepareNodeAddedMessage(msg0, clientMsgWorker.clientNodeId, null, null, null);
 
@@ -3140,7 +3140,7 @@ class ServerImpl extends TcpDiscoveryImpl {
                             Map<String, Object> attrs = new HashMap<>(node.getAttributes());
 
                             attrs.put(IgniteNodeAttributes.ATTR_SECURITY_SUBJECT,
-                                    MarshallerUtils.marshal(spi.marsh, subj, spi.ignite().configuration()));
+                                    MarshallerUtils.marshal(spi.marsh, subj, spi.ignite().name()));
 
                             node.setAttributes(attrs);
                         }
@@ -3795,7 +3795,7 @@ class ServerImpl extends TcpDiscoveryImpl {
 
                             SecurityContext coordSubj = MarshallerUtils.unmarshal(spi.marsh,
                                 node.<byte[]>attribute(IgniteNodeAttributes.ATTR_SECURITY_SUBJECT),
-                                U.resolveClassLoader(cfg), cfg);
+                                U.resolveClassLoader(cfg), cfg.getGridName());
 
                             if (!permissionsEqual(coordSubj.subject().permissions(), subj.subject().permissions())) {
                                 // Node has not pass authentication.
@@ -4847,7 +4847,7 @@ class ServerImpl extends TcpDiscoveryImpl {
 
                     try {
                         msgObj = msg.message(spi.marsh, U.resolveClassLoader(spi.ignite().configuration()),
-                                spi.ignite().configuration());
+                                spi.ignite().name());
                     }
                     catch (Throwable e) {
                         U.error(log, "Failed to unmarshal discovery custom message.", e);
@@ -4860,7 +4860,7 @@ class ServerImpl extends TcpDiscoveryImpl {
                             try {
                                 TcpDiscoveryCustomEventMessage ackMsg = new TcpDiscoveryCustomEventMessage(
                                     getLocalNodeId(), nextMsg,
-                                        MarshallerUtils.marshal(spi.marsh, nextMsg, spi.ignite().configuration()));
+                                        MarshallerUtils.marshal(spi.marsh, nextMsg, spi.ignite().name()));
 
                                 ackMsg.topologyVersion(msg.topologyVersion());
 
@@ -4994,7 +4994,7 @@ class ServerImpl extends TcpDiscoveryImpl {
                         final IgniteConfiguration cfg = spi.ignite().configuration();
 
                         DiscoverySpiCustomMessage msgObj = msg.message(spi.marsh,
-                            U.resolveClassLoader(cfg), cfg);
+                            U.resolveClassLoader(cfg), cfg.getGridName());
 
                         lsnr.onDiscovery(DiscoveryCustomEvent.EVT_DISCOVERY_CUSTOM_EVT,
                             msg.topologyVersion(),
@@ -5005,7 +5005,7 @@ class ServerImpl extends TcpDiscoveryImpl {
 
                         if (msgObj.isMutable())
                             msg.message(msgObj,
-                                    MarshallerUtils.marshal(spi.marsh, msgObj, spi.ignite().configuration()));
+                                    MarshallerUtils.marshal(spi.marsh, msgObj, spi.ignite().name()));
                     }
                     catch (Throwable e) {
                         U.error(log, "Failed to unmarshal discovery custom message.", e);
@@ -5932,7 +5932,7 @@ class ServerImpl extends TcpDiscoveryImpl {
                 byte[] msgBytes = msgT.get2();
 
                 if (msgBytes == null)
-                    msgBytes = MarshallerUtils.marshal(spi.marsh, msg, spi.ignite().configuration());
+                    msgBytes = MarshallerUtils.marshal(spi.marsh, msg, spi.ignite().name());
 
                 if (msg instanceof TcpDiscoveryClientAckResponse) {
                     if (clientVer == null) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/63210e6d/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
index bb01f74..61186d7 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
@@ -1678,7 +1678,7 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi, T
 
         for (Map.Entry<Integer, Serializable> entry : data.entrySet()) {
             try {
-                byte[] bytes = MarshallerUtils.marshal(marsh, entry.getValue(), ignite.configuration());
+                byte[] bytes = MarshallerUtils.marshal(marsh, entry.getValue(), ignite.name());
 
                 data0.put(entry.getKey(), bytes);
             }
@@ -1709,7 +1709,7 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi, T
         for (Map.Entry<Integer, byte[]> entry : data.entrySet()) {
             try {
                 Serializable compData = MarshallerUtils.unmarshal(marsh, entry.getValue(), clsLdr,
-                        ignite.configuration());
+                        ignite.name());
 
                 data0.put(entry.getKey(), compData);
             }

http://git-wip-us.apache.org/repos/asf/ignite/blob/63210e6d/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 d213eaa..24f4803 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
@@ -361,7 +361,7 @@ public class TcpDiscoveryMulticastIpFinder extends TcpDiscoveryVmIpFinder {
             if (!addr.isLoopbackAddress()) {
                 try {
                     if (!clientMode)
-                        addrSnds.add(new AddressSender(mcastAddr, addr, addrs, getIgniteConfiguration()));
+                        addrSnds.add(new AddressSender(mcastAddr, addr, addrs));
 
                     reqItfs.add(addr);
                 }
@@ -381,7 +381,7 @@ public class TcpDiscoveryMulticastIpFinder extends TcpDiscoveryVmIpFinder {
                 try {
                     // Create non-bound socket if local host is loopback or failed to create sockets explicitly
                     // bound to interfaces.
-                    addrSnds.add(new AddressSender(mcastAddr, null, addrs, getIgniteConfiguration()));
+                    addrSnds.add(new AddressSender(mcastAddr, null, addrs));
                 }
                 catch (IOException e) {
                     if (log.isDebugEnabled())
@@ -391,7 +391,7 @@ public class TcpDiscoveryMulticastIpFinder extends TcpDiscoveryVmIpFinder {
 
                 if (addrSnds.isEmpty()) {
                     try {
-                        addrSnds.add(new AddressSender(mcastAddr, mcastAddr, addrs, getIgniteConfiguration()));
+                        addrSnds.add(new AddressSender(mcastAddr, mcastAddr, addrs));
 
                         reqItfs.add(mcastAddr);
                     }
@@ -595,7 +595,7 @@ public class TcpDiscoveryMulticastIpFinder extends TcpDiscoveryVmIpFinder {
                             AddressResponse addrRes;
 
                             try {
-                                addrRes = new AddressResponse(data, getIgniteConfiguration());
+                                addrRes = new AddressResponse(data, getGridName());
                             }
                             catch (IgniteCheckedException e) {
                                 LT.warn(log, e, "Failed to deserialize multicast response.");
@@ -647,8 +647,8 @@ public class TcpDiscoveryMulticastIpFinder extends TcpDiscoveryVmIpFinder {
      *
      * @return Ignite config or {@code null}.
      */
-    @Nullable private IgniteConfiguration getIgniteConfiguration() {
-        return ignite == null ? null : ignite.configuration();
+    @Nullable private String getGridName() {
+        return ignite == null ? null : ignite.name();
     }
 
     /** {@inheritDoc} */
@@ -699,10 +699,10 @@ public class TcpDiscoveryMulticastIpFinder extends TcpDiscoveryVmIpFinder {
          * @param addrs Addresses discovery SPI binds to.
          * @throws IgniteCheckedException If marshalling failed.
          */
-        private AddressResponse(Collection<InetSocketAddress> addrs, final IgniteConfiguration igniteCfg) throws IgniteCheckedException {
+        private AddressResponse(Collection<InetSocketAddress> addrs, final String gridName) throws IgniteCheckedException {
             this.addrs = addrs;
 
-            byte[] addrsData = MarshallerUtils.marshal(marsh, addrs, igniteCfg);
+            byte[] addrsData = MarshallerUtils.marshal(marsh, addrs, gridName);
             data = new byte[U.IGNITE_HEADER.length + addrsData.length];
 
             if (data.length > MAX_DATA_LENGTH)
@@ -714,15 +714,16 @@ public class TcpDiscoveryMulticastIpFinder extends TcpDiscoveryVmIpFinder {
 
         /**
          * @param data Message data.
+         * @param gridName Grid name.
          * @throws IgniteCheckedException If unmarshalling failed.
          */
-        private AddressResponse(byte[] data, final IgniteConfiguration igniteCfg) throws IgniteCheckedException {
+        private AddressResponse(byte[] data, final String gridName) throws IgniteCheckedException {
             assert U.bytesEqual(U.IGNITE_HEADER, 0, data, 0, U.IGNITE_HEADER.length);
 
             this.data = data;
 
             addrs = MarshallerUtils.unmarshal(marsh,
-                    Arrays.copyOfRange(data, U.IGNITE_HEADER.length, data.length), null, igniteCfg);
+                    Arrays.copyOfRange(data, U.IGNITE_HEADER.length, data.length), null, gridName);
         }
 
         /**
@@ -794,24 +795,18 @@ public class TcpDiscoveryMulticastIpFinder extends TcpDiscoveryVmIpFinder {
         /** */
         private final InetAddress sockItf;
 
-        /** */
-        private final IgniteConfiguration igniteCfg;
-
         /**
          * @param mcastGrp Multicast address.
          * @param sockItf Optional interface multicast socket should be bound to.
          * @param addrs Local node addresses.
-         * @param igniteCfg Ignite configuration.
          * @throws IOException If fails to create multicast socket.
          */
-        private AddressSender(InetAddress mcastGrp, @Nullable InetAddress sockItf, Collection<InetSocketAddress> addrs,
-            final IgniteConfiguration igniteCfg)
+        private AddressSender(InetAddress mcastGrp, @Nullable InetAddress sockItf, Collection<InetSocketAddress> addrs)
             throws IOException {
             super(ignite == null ? null : ignite.name(), "tcp-disco-multicast-addr-sender", log);
             this.mcastGrp = mcastGrp;
             this.addrs = addrs;
             this.sockItf = sockItf;
-            this.igniteCfg = igniteCfg;
 
             sock = createSocket();
         }
@@ -847,7 +842,7 @@ public class TcpDiscoveryMulticastIpFinder extends TcpDiscoveryVmIpFinder {
             AddressResponse res;
 
             try {
-                res = new AddressResponse(addrs, igniteCfg);
+                res = new AddressResponse(addrs, gridName);
             }
             catch (IgniteCheckedException e) {
                 U.error(log, "Failed to prepare multicast message.", e);

http://git-wip-us.apache.org/repos/asf/ignite/blob/63210e6d/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryCustomEventMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryCustomEventMessage.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryCustomEventMessage.java
index 1555718..e75e8ca 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryCustomEventMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryCustomEventMessage.java
@@ -74,25 +74,25 @@ public class TcpDiscoveryCustomEventMessage extends TcpDiscoveryAbstractMessage
 
     /**
      * @param marsh Marshaller.
-     * @param igniteCfg Ignite configuration.
+     * @param gridName Grid name.
      * @return Deserialized message.
      * @throws java.lang.Throwable if unmarshal failed.
      */
-    @Nullable public DiscoverySpiCustomMessage message(@NotNull Marshaller marsh, IgniteConfiguration igniteCfg) throws Throwable {
-        return message(marsh, null, igniteCfg);
+    @Nullable public DiscoverySpiCustomMessage message(@NotNull Marshaller marsh, String gridName) throws Throwable {
+        return message(marsh, null, gridName);
     }
 
     /**
      * @param marsh Marshaller.
      * @param ldr Class loader.
-     * @param igniteCfg Ignite configuration.
+     * @param gridName Grid name.
      * @return Deserialized message.
      * @throws java.lang.Throwable if unmarshal failed.
      */
     @Nullable public DiscoverySpiCustomMessage message(@NotNull Marshaller marsh, ClassLoader ldr,
-        final IgniteConfiguration igniteCfg) throws Throwable {
+        final String gridName) throws Throwable {
         if (msg == null) {
-            msg = MarshallerUtils.unmarshal(marsh, msgBytes, ldr, igniteCfg);
+            msg = MarshallerUtils.unmarshal(marsh, msgBytes, ldr, gridName);
 
             assert msg != null;
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/63210e6d/modules/core/src/main/java/org/apache/ignite/spi/swapspace/file/FileSwapSpaceSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/swapspace/file/FileSwapSpaceSpi.java b/modules/core/src/main/java/org/apache/ignite/spi/swapspace/file/FileSwapSpaceSpi.java
index a9e19b5..b8365c5 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/swapspace/file/FileSwapSpaceSpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/swapspace/file/FileSwapSpaceSpi.java
@@ -595,7 +595,7 @@ public class FileSwapSpaceSpi extends IgniteSpiAdapter implements SwapSpaceSpi,
 
         if (keyBytes == null) {
             try {
-                keyBytes = MarshallerUtils.marshal(ignite.configuration().getMarshaller(), key.key(), ignite.configuration());
+                keyBytes = MarshallerUtils.marshal(ignite.configuration().getMarshaller(), key.key(), ignite.name());
             }
             catch (IgniteCheckedException e) {
                 throw new IgniteSpiException("Failed to marshal key: " + key.key(), e);

http://git-wip-us.apache.org/repos/asf/ignite/blob/63210e6d/modules/core/src/main/java/org/apache/ignite/stream/socket/SocketMessageConverter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/stream/socket/SocketMessageConverter.java b/modules/core/src/main/java/org/apache/ignite/stream/socket/SocketMessageConverter.java
index d1372ee..9e2ca67 100644
--- a/modules/core/src/main/java/org/apache/ignite/stream/socket/SocketMessageConverter.java
+++ b/modules/core/src/main/java/org/apache/ignite/stream/socket/SocketMessageConverter.java
@@ -17,8 +17,6 @@
 
 package org.apache.ignite.stream.socket;
 
-import org.apache.ignite.configuration.IgniteConfiguration;
-
 /**
  * Socket message converter.
  */
@@ -27,8 +25,8 @@ public interface SocketMessageConverter<T> {
      * Converter message represented by array of bytes to object.
      *
      * @param msg Message.
-     * @param igniteCfg Ignite config.
+     * @param gridName Grid name.
      * @return Converted object.
      */
-    public T convert(byte[] msg, IgniteConfiguration igniteCfg);
+    public T convert(byte[] msg, String gridName);
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/63210e6d/modules/core/src/main/java/org/apache/ignite/stream/socket/SocketStreamer.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/stream/socket/SocketStreamer.java b/modules/core/src/main/java/org/apache/ignite/stream/socket/SocketStreamer.java
index 24580e7..7378bd2 100644
--- a/modules/core/src/main/java/org/apache/ignite/stream/socket/SocketStreamer.java
+++ b/modules/core/src/main/java/org/apache/ignite/stream/socket/SocketStreamer.java
@@ -165,7 +165,7 @@ public class SocketStreamer<T, K, V> extends StreamAdapter<T, K, V> {
             }
 
             @Override public void onMessage(GridNioSession ses, byte[] msg) {
-                addMessage(converter.convert(msg, ses.igniteConfiguration()));
+                addMessage(converter.convert(msg, ses.gridName()));
             }
         };
 
@@ -220,9 +220,9 @@ public class SocketStreamer<T, K, V> extends StreamAdapter<T, K, V> {
         private static final JdkMarshaller MARSH = new JdkMarshaller();
 
         /** {@inheritDoc} */
-        @Override public T convert(byte[] msg, final IgniteConfiguration igniteCfg) {
+        @Override public T convert(byte[] msg, final String gridName) {
             try {
-                return MarshallerUtils.unmarshal(MARSH, msg, null, igniteCfg);
+                return MarshallerUtils.unmarshal(MARSH, msg, null, gridName);
             }
             catch (IgniteCheckedException e) {
                 throw new IgniteException(e);

http://git-wip-us.apache.org/repos/asf/ignite/blob/63210e6d/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridBinaryCacheSerializationTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridBinaryCacheSerializationTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridBinaryCacheSerializationTest.java
index 0308ab6..d5de056 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridBinaryCacheSerializationTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridBinaryCacheSerializationTest.java
@@ -17,11 +17,26 @@
 
 package org.apache.ignite.internal.processors.cache.binary;
 
+import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCache;
 import org.apache.ignite.Ignition;
+import org.apache.ignite.binary.BinaryObjectException;
+import org.apache.ignite.binary.BinaryReader;
+import org.apache.ignite.binary.BinaryWriter;
+import org.apache.ignite.binary.Binarylizable;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.binary.BinaryMarshaller;
+import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.testframework.junits.GridAbstractTest;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutput;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
 import java.lang.reflect.Method;
 
 /**
@@ -49,48 +64,110 @@ public class GridBinaryCacheSerializationTest extends GridCommonAbstractTest {
         runTest.invoke(this);
     }
 
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(final String gridName) throws Exception {
+        final IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+        if (gridName != null && gridName.startsWith("binary"))
+            cfg.setMarshaller(new BinaryMarshaller());
+
+        return cfg;
+    }
+
     /**
      * Test that calling {@link Ignition#localIgnite()}
      * is safe for binary marshaller.
      *
      * @throws Exception
      */
-    public void testPutGet() throws Exception {
-        final IgniteCache<Integer, MyObj> cache = startGrid().getOrCreateCache(CACHE_NAME);
+    public void testPutGetSimple() throws Exception {
+        testPutGet(new SimpleTestObject("one"), null);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testSerializable() throws Exception {
+        testPutGet(new SerializableTestObject("test"), null);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testPutGetExternalizable() throws Exception {
+        testPutGet(new ExternalizableTestObject("test"), null);
+    }
 
-        final MyObj one = new MyObj("one");
-        final MyObj two = new MyObj("two");
-        final MyObj three = new MyObj("three");
+    /**
+     * @throws Exception If failed.
+     */
+    public void testPutGetBinarylizable() throws Exception {
+        testPutGet(new BinarylizableTestObject("test"), "binaryIgnite");
+    }
 
-        cache.put(1, one);
-        cache.put(2, two);
-        cache.put(3, three);
+    /**
+     * @throws Exception If failed.
+     */
+    private void testPutGet(final TestObject obj, final String gridName) throws Exception {
+        try (final Ignite ignite = startGrid(gridName)) {
+            final IgniteCache<Integer, TestObject> cache = ignite.getOrCreateCache(CACHE_NAME);
 
-        final MyObj loadedOne = cache.get(1);
-        final MyObj loadedTwo = cache.get(2);
-        final MyObj loadedThree = cache.get(3);
+            assertNull(obj.ignite());
 
-        assert one.equals(loadedOne);
-        assert two.equals(loadedTwo);
-        assert three.equals(loadedThree);
+            cache.put(1, obj);
 
+            assertNotNull(obj.ignite());
+
+            final TestObject loadedObj = cache.get(1);
+
+            assertNotNull(loadedObj.ignite());
+
+            assertEquals(obj, loadedObj);
+        }
     }
 
     /**
-     * Test obj.
+     *
      */
-    private static class MyObj {
+    private interface TestObject {
+        /**
+         * @return Ignite instance.
+         */
+        Ignite ignite();
+    }
 
+    /**
+     * Test object.
+     */
+    private static class SimpleTestObject implements TestObject {
         /** */
-        final String val;
+        private final String val;
 
         /** */
-        private MyObj(final String val) {
+        private transient Ignite ignite;
+
+        /** */
+        private SimpleTestObject(final String val) {
             this.val = val;
         }
 
+        /**
+         * @return Object.
+         */
+        @SuppressWarnings("unused")
         private Object readResolve() {
-            Ignition.localIgnite();
+            ignite = Ignition.localIgnite();
+
+            return this;
+        }
+
+        /**
+         * @return Object.
+         */
+        @SuppressWarnings("unused")
+        private Object writeReplace() {
+            ignite = Ignition.localIgnite();
+
             return this;
         }
 
@@ -99,15 +176,195 @@ public class GridBinaryCacheSerializationTest extends GridCommonAbstractTest {
             if (this == o) return true;
             if (o == null || getClass() != o.getClass()) return false;
 
-            final MyObj myObj = (MyObj) o;
+            final SimpleTestObject simpleTestObj = (SimpleTestObject) o;
+
+            return val != null ? val.equals(simpleTestObj.val) : simpleTestObj.val == null;
+
+        }
+
+        /** */
+        @Override public int hashCode() {
+            return val != null ? val.hashCode() : 0;
+        }
+
+        /** {@inheritDoc} */
+        @Override public Ignite ignite() {
+            return ignite;
+        }
+    }
+
+    /**
+     *
+     */
+    private static class SerializableTestObject implements Serializable, TestObject {
+        /** */
+        private static final long serialVersionUID = 0L;
+
+        /** */
+        private String val;
+
+        /** */
+        private transient Ignite ignite;
+
+        public SerializableTestObject() {
+        }
+
+        public SerializableTestObject(final String val) {
+            this.val = val;
+        }
+
+        private void writeObject(ObjectOutputStream out) throws IOException {
+            U.writeString(out, val);
+
+            ignite = Ignition.localIgnite();
+        }
+
+        private void readObject(ObjectInputStream in) throws IOException {
+            val = U.readString(in);
+
+            ignite = Ignition.localIgnite();
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean equals(final Object o) {
+            if (this == o) return true;
+            if (o == null || getClass() != o.getClass()) return false;
+
+            final SerializableTestObject that = (SerializableTestObject) o;
+
+            return val != null ? val.equals(that.val) : that.val == null;
+
+        }
+
+        /** {@inheritDoc} */
+        @Override public int hashCode() {
+            return val != null ? val.hashCode() : 0;
+        }
+
+        /** {@inheritDoc} */
+        @Override public Ignite ignite() {
+            return ignite;
+        }
+    }
+
+    /**
+     *
+     */
+    private static class ExternalizableTestObject implements Externalizable, TestObject {
+        /** */
+        private static final long serialVersionUID = 0L;
+
+        /** */
+        private String val;
+
+        /** */
+        private transient Ignite ignite;
+
+        /**
+         *
+         */
+        public ExternalizableTestObject() {
+        }
+
+        /**
+         * @param val Value.
+         */
+        public ExternalizableTestObject(final String val) {
+            this.val = val;
+        }
+
+        /** {@inheritDoc} */
+        @Override public void writeExternal(final ObjectOutput out) throws IOException {
+            U.writeString(out, val);
+
+            ignite = Ignition.localIgnite();
+        }
+
+        /** {@inheritDoc} */
+        @Override public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
+            val = U.readString(in);
+
+            ignite = Ignition.localIgnite();
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean equals(final Object o) {
+            if (this == o) return true;
+            if (o == null || getClass() != o.getClass()) return false;
+
+            final ExternalizableTestObject that = (ExternalizableTestObject) o;
 
-            return val != null ? val.equals(myObj.val) : myObj.val == null;
+            return val != null ? val.equals(that.val) : that.val == null;
 
         }
 
+        /** {@inheritDoc} */
+        @Override public int hashCode() {
+            return val != null ? val.hashCode() : 0;
+        }
+
+        /** {@inheritDoc} */
+        @Override public Ignite ignite() {
+            return ignite;
+        }
+    }
+
+    /**
+     *
+     */
+    private static class BinarylizableTestObject implements Binarylizable, TestObject {
+        /** */
+        private String val;
+
         /** */
+        private transient Ignite ignite;
+
+        /**
+         *
+         */
+        public BinarylizableTestObject() {
+        }
+
+        /**
+         * @param val Value.
+         */
+        public BinarylizableTestObject(final String val) {
+            this.val = val;
+        }
+
+        /** {@inheritDoc} */
+        @Override public void writeBinary(final BinaryWriter writer) throws BinaryObjectException {
+            writer.rawWriter().writeString(val);
+
+            ignite = Ignition.localIgnite();
+        }
+
+        /** {@inheritDoc} */
+        @Override public void readBinary(final BinaryReader reader) throws BinaryObjectException {
+            val = reader.rawReader().readString();
+
+            ignite = Ignition.localIgnite();
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean equals(final Object o) {
+            if (this == o) return true;
+            if (o == null || getClass() != o.getClass()) return false;
+
+            final BinarylizableTestObject that = (BinarylizableTestObject) o;
+
+            return val != null ? val.equals(that.val) : that.val == null;
+
+        }
+
+        /** {@inheritDoc} */
         @Override public int hashCode() {
             return val != null ? val.hashCode() : 0;
         }
+
+        /** {@inheritDoc} */
+        @Override public Ignite ignite() {
+            return ignite;
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/63210e6d/modules/core/src/test/java/org/apache/ignite/internal/util/nio/impl/GridNioFilterChainSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/util/nio/impl/GridNioFilterChainSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/util/nio/impl/GridNioFilterChainSelfTest.java
index 043ec02..e47fc0f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/util/nio/impl/GridNioFilterChainSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/util/nio/impl/GridNioFilterChainSelfTest.java
@@ -380,7 +380,7 @@ public class GridNioFilterChainSelfTest extends GridCommonAbstractTest {
         }
 
         /** {@inheritDoc} */
-        @Override public IgniteConfiguration igniteConfiguration() {
+        @Override public String gridName() {
             return null;
         }
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/63210e6d/modules/core/src/test/java/org/apache/ignite/stream/socket/SocketStreamerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/stream/socket/SocketStreamerSelfTest.java b/modules/core/src/test/java/org/apache/ignite/stream/socket/SocketStreamerSelfTest.java
index a76a1fa..a59ebea 100644
--- a/modules/core/src/test/java/org/apache/ignite/stream/socket/SocketStreamerSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/stream/socket/SocketStreamerSelfTest.java
@@ -169,7 +169,7 @@ public class SocketStreamerSelfTest extends GridCommonAbstractTest {
      */
     public void testSizeBasedCustomConverter() throws Exception {
         SocketMessageConverter<Message> converter = new SocketMessageConverter<Message>() {
-            @Override public Message convert(byte[] msg, IgniteConfiguration cfg) {
+            @Override public Message convert(byte[] msg, String gridName) {
                 int i = (msg[0] & 0xFF) << 24;
                 i |= (msg[1] & 0xFF) << 16;
                 i |= (msg[2] & 0xFF) << 8;
@@ -233,7 +233,7 @@ public class SocketStreamerSelfTest extends GridCommonAbstractTest {
      */
     public void testDelimiterBasedCustomConverter() throws Exception {
         SocketMessageConverter<Message> converter = new SocketMessageConverter<Message>() {
-            @Override public Message convert(byte[] msg, IgniteConfiguration cfg) {
+            @Override public Message convert(byte[] msg, String gridName) {
                 int i = (msg[0] & 0xFF) << 24;
                 i |= (msg[1] & 0xFF) << 16;
                 i |= (msg[2] & 0xFF) << 8;

http://git-wip-us.apache.org/repos/asf/ignite/blob/63210e6d/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/taskexecutor/external/communication/HadoopExternalCommunication.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/taskexecutor/external/communication/HadoopExternalCommunication.java b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/taskexecutor/external/communication/HadoopExternalCommunication.java
index 736c69f..2c87540 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/taskexecutor/external/communication/HadoopExternalCommunication.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/taskexecutor/external/communication/HadoopExternalCommunication.java
@@ -1175,15 +1175,12 @@ public class HadoopExternalCommunication {
 
             this.endpoint = endpoint;
 
-            final IgniteConfiguration cfg = new IgniteConfiguration(); // TODO provide real config
-            cfg.setGridName(gridName);
-
             adapter = new HadoopIpcToNioAdapter<>(
                 HadoopExternalCommunication.this.log,
                 endpoint,
                 accepted,
                 srvLsnr,
-                cfg,
+                gridName,
                 filters());
         }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/63210e6d/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/taskexecutor/external/communication/HadoopIpcToNioAdapter.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/taskexecutor/external/communication/HadoopIpcToNioAdapter.java b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/taskexecutor/external/communication/HadoopIpcToNioAdapter.java
index 1000b8a..23c6510 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/taskexecutor/external/communication/HadoopIpcToNioAdapter.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/taskexecutor/external/communication/HadoopIpcToNioAdapter.java
@@ -63,15 +63,15 @@ public class HadoopIpcToNioAdapter<T> {
      * @param log Log.
      * @param endp Endpoint.
      * @param lsnr Listener.
-     * @param igniteCfg Ignite config.
+     * @param gridname Ignite config.
      * @param filters Filters.
      */
     public HadoopIpcToNioAdapter(IgniteLogger log, IpcEndpoint endp, boolean accepted,
-        GridNioServerListener<T> lsnr, IgniteConfiguration igniteCfg, GridNioFilter... filters) {
+        GridNioServerListener<T> lsnr, String gridname, GridNioFilter... filters) {
         this.endp = endp;
 
         chain = new GridNioFilterChain<>(log, lsnr, new HeadFilter(), filters);
-        ses = new GridNioSessionImpl(chain, null, null, accepted, igniteCfg);
+        ses = new GridNioSessionImpl(chain, null, null, accepted, gridname);
 
         writeBuf = ByteBuffer.allocate(8 << 10);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/63210e6d/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/taskexecutor/external/communication/HadoopMarshallerFilter.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/taskexecutor/external/communication/HadoopMarshallerFilter.java b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/taskexecutor/external/communication/HadoopMarshallerFilter.java
index d0cbecc..a2e3902 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/taskexecutor/external/communication/HadoopMarshallerFilter.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/taskexecutor/external/communication/HadoopMarshallerFilter.java
@@ -60,7 +60,7 @@ public class HadoopMarshallerFilter extends GridNioFilterAdapter {
     @Override public GridNioFuture<?> onSessionWrite(GridNioSession ses, Object msg) throws IgniteCheckedException {
         assert msg instanceof HadoopMessage : "Invalid message type: " + msg;
 
-        return proceedSessionWrite(ses, MarshallerUtils.marshal(marshaller, msg, ses.igniteConfiguration()));
+        return proceedSessionWrite(ses, MarshallerUtils.marshal(marshaller, msg, ses.gridName()));
     }
 
     /** {@inheritDoc} */
@@ -68,7 +68,7 @@ public class HadoopMarshallerFilter extends GridNioFilterAdapter {
         assert msg instanceof byte[];
 
         // Always unmarshal with system classloader.
-        proceedMessageReceived(ses, MarshallerUtils.unmarshal(marshaller, (byte[])msg, null, ses.igniteConfiguration()));
+        proceedMessageReceived(ses, MarshallerUtils.unmarshal(marshaller, (byte[])msg, null, ses.gridName()));
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/63210e6d/modules/web/src/main/java/org/apache/ignite/cache/websession/WebSessionFilter.java
----------------------------------------------------------------------
diff --git a/modules/web/src/main/java/org/apache/ignite/cache/websession/WebSessionFilter.java b/modules/web/src/main/java/org/apache/ignite/cache/websession/WebSessionFilter.java
index 414fef1..17c0a29 100644
--- a/modules/web/src/main/java/org/apache/ignite/cache/websession/WebSessionFilter.java
+++ b/modules/web/src/main/java/org/apache/ignite/cache/websession/WebSessionFilter.java
@@ -516,7 +516,7 @@ public class WebSessionFilter implements Filter {
 
                     if (entity != null) {
                         cached = new WebSessionV2(sesId, httpReq.getSession(false), false, ctx, entity, marshaller,
-                            webSesIgnite.configuration());
+                            webSesIgnite.name());
                     }
 
                     break;
@@ -700,7 +700,7 @@ public class WebSessionFilter implements Filter {
         if (log.isDebugEnabled())
             log.debug("Session created: " + sesId);
 
-        WebSessionV2 cached = new WebSessionV2(sesId, ses, true, ctx, null, marshaller, webSesIgnite.configuration());
+        WebSessionV2 cached = new WebSessionV2(sesId, ses, true, ctx, null, marshaller, webSesIgnite.name());
 
         final WebSessionEntity marshaledEntity = cached.marshalAttributes();
 
@@ -712,9 +712,9 @@ public class WebSessionFilter implements Filter {
                 final WebSessionEntity old = cache0.getAndPutIfAbsent(sesId, marshaledEntity);
 
                 if (old != null)
-                    cached = new WebSessionV2(sesId, ses, false, ctx, old, marshaller, webSesIgnite.configuration());
+                    cached = new WebSessionV2(sesId, ses, false, ctx, old, marshaller, webSesIgnite.name());
                 else
-                    cached = new WebSessionV2(sesId, ses, false, ctx, marshaledEntity, marshaller, webSesIgnite.configuration());
+                    cached = new WebSessionV2(sesId, ses, false, ctx, marshaledEntity, marshaller, webSesIgnite.name());
 
                 break;
             }

http://git-wip-us.apache.org/repos/asf/ignite/blob/63210e6d/modules/web/src/main/java/org/apache/ignite/cache/websession/WebSessionV2.java
----------------------------------------------------------------------
diff --git a/modules/web/src/main/java/org/apache/ignite/cache/websession/WebSessionV2.java b/modules/web/src/main/java/org/apache/ignite/cache/websession/WebSessionV2.java
index 28d16b1..fd420d9 100644
--- a/modules/web/src/main/java/org/apache/ignite/cache/websession/WebSessionV2.java
+++ b/modules/web/src/main/java/org/apache/ignite/cache/websession/WebSessionV2.java
@@ -19,7 +19,6 @@ package org.apache.ignite.cache.websession;
 
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.IgniteException;
-import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.internal.util.tostring.GridToStringExclude;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.websession.WebSessionEntity;
@@ -90,7 +89,7 @@ class WebSessionV2 implements HttpSession {
     private final HttpSession genuineSes;
 
     /** Ignite config. */
-    private final IgniteConfiguration cfg;
+    private final String gridName;
 
     /**
      * @param id Session ID.
@@ -98,18 +97,18 @@ class WebSessionV2 implements HttpSession {
      * @param isNew Is new flag.
      */
     WebSessionV2(final String id, final @Nullable HttpSession ses, final boolean isNew, final ServletContext ctx,
-        @Nullable WebSessionEntity entity, final Marshaller marshaller, final IgniteConfiguration cfg) {
+        @Nullable WebSessionEntity entity, final Marshaller marshaller, final String gridName) {
         assert id != null;
         assert marshaller != null;
         assert ctx != null;
         assert ses != null || entity != null;
-        assert cfg != null;
+        assert gridName != null;
 
         this.marshaller = marshaller;
         this.ctx = ctx;
         this.isNew = isNew;
         this.genuineSes = ses;
-        this.cfg = cfg;
+        this.gridName = gridName;
 
         accessTime = System.currentTimeMillis();
 
@@ -340,7 +339,7 @@ class WebSessionV2 implements HttpSession {
     @Nullable private <T> T unmarshal(final byte[] bytes) throws IOException {
         if (marshaller != null) {
             try {
-                return MarshallerUtils.unmarshal(marshaller, bytes, getClass().getClassLoader(), cfg);
+                return MarshallerUtils.unmarshal(marshaller, bytes, getClass().getClassLoader(), gridName);
             }
             catch (IgniteCheckedException e) {
                 throw new IOException(e);
@@ -360,7 +359,7 @@ class WebSessionV2 implements HttpSession {
     @Nullable private byte[] marshal(final Object obj) throws IOException {
         if (marshaller != null) {
             try {
-                return MarshallerUtils.marshal(marshaller, obj, cfg);
+                return MarshallerUtils.marshal(marshaller, obj, gridName);
             }
             catch (IgniteCheckedException e) {
                 throw new IOException(e);


Mime
View raw message