This is an automated email from the ASF dual-hosted git repository.

namelchev pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
     new 918de0de649 IGNITE-28364 Finalize migration of GridCacheMessage 
(#12940)
918de0de649 is described below

commit 918de0de6491d531da84a291f544fd45833c3b46
Author: Nikita Amelchev <[email protected]>
AuthorDate: Fri Mar 27 12:39:33 2026 +0300

    IGNITE-28364 Finalize migration of GridCacheMessage (#12940)
---
 .../processors/cache/GridCacheGroupIdMessage.java  |  52 ---
 .../processors/cache/GridCacheIdMessage.java       |  52 ---
 .../processors/cache/GridCacheIoManager.java       |   5 +-
 .../processors/cache/GridCacheMessage.java         |  78 +---
 .../distributed/GridCacheTxRecoveryResponse.java   |  33 +-
 .../distributed/GridDistributedLockResponse.java   |  40 +-
 .../GridDistributedTxPrepareResponse.java          |  21 -
 .../cache/distributed/dht/GridDhtCacheAdapter.java |   3 +-
 .../cache/distributed/dht/GridDhtLockResponse.java |  33 +-
 .../distributed/dht/GridDhtTxPrepareResponse.java  |  33 +-
 .../GridDhtAtomicDeferredUpdateResponse.java       |  11 +-
 .../dht/atomic/GridDhtAtomicNearResponse.java      |  40 +-
 .../dht/atomic/GridDhtAtomicUpdateResponse.java    |  32 +-
 .../dht/atomic/GridNearAtomicUpdateResponse.java   |  22 +-
 .../dht/preloader/GridDhtForceKeysResponse.java    |  71 +--
 .../distributed/near/GridNearGetResponse.java      |  50 +--
 .../distributed/near/GridNearLockResponse.java     |  75 +---
 .../near/GridNearSingleGetResponse.java            |  50 +--
 .../distributed/near/GridNearTxFinishResponse.java |  39 +-
 .../near/GridNearTxPrepareResponse.java            | 105 +----
 .../cache/query/GridCacheQueryResponse.java        |  41 +-
 .../continuous/CacheContinuousQueryBatchAck.java   |  20 +-
 .../continuous/CacheContinuousQueryManager.java    |   2 +-
 .../TcpCommunicationSpiSslVolatilePayloadTest.java |  10 +-
 .../GridAbstractCommunicationSelfTest.java         |  12 +-
 .../communication/GridCacheMessageSelfTest.java    | 494 +--------------------
 .../ignite/spi/communication/GridTestMessage.java  | 114 +----
 .../ignite/spi/communication/TestBadMessage.java   |  62 +++
 .../ignite/spi/communication/TestMessage.java      |  53 +++
 .../ignite/spi/communication/TestMessage1.java     |  67 +++
 .../ignite/spi/communication/TestMessage2.java     |  85 ++++
 .../communication/TestVolatilePayloadMessage.java  |  85 +---
 .../CommunicationConnectionPoolMetricsTest.java    |  24 +-
 .../tcp/GridTcpCommunicationSpiAbstractTest.java   |   9 +-
 ...pCommunicationSpiConcurrentConnectSelfTest.java |  10 +-
 .../tcp/GridTcpCommunicationSpiConfigSelfTest.java |   5 +-
 ...idTcpCommunicationSpiMultithreadedSelfTest.java |   5 +-
 ...GridTcpCommunicationSpiRecoveryAckSelfTest.java |  10 +-
 .../GridTcpCommunicationSpiRecoverySelfTest.java   |   5 +-
 ...TcpCommunicationRecoveryAckClosureSelfTest.java |  10 +-
 .../tcp/TcpCommunicationStatisticsTest.java        |   8 +-
 41 files changed, 395 insertions(+), 1581 deletions(-)

diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheGroupIdMessage.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheGroupIdMessage.java
index 4e41c0f6d1d..d260dfe33a5 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheGroupIdMessage.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheGroupIdMessage.java
@@ -17,12 +17,9 @@
 
 package org.apache.ignite.internal.processors.cache;
 
-import java.nio.ByteBuffer;
 import org.apache.ignite.internal.Order;
 import org.apache.ignite.internal.util.tostring.GridToStringInclude;
 import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.plugin.extensions.communication.MessageReader;
-import org.apache.ignite.plugin.extensions.communication.MessageWriter;
 
 /**
  * Message related to particular cache group.
@@ -40,55 +37,6 @@ public abstract class GridCacheGroupIdMessage extends 
GridCacheMessage {
         return grpId;
     }
 
-    /** {@inheritDoc} */
-    @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
-        // TODO: Safe to remove only after all inheritors have migrated to the 
new ser/der scheme (IGNITE-25490).
-        writer.setBuffer(buf);
-
-        if (!super.writeTo(buf, writer))
-            return false;
-
-        if (!writer.isHeaderWritten()) {
-            if (!writer.writeHeader(directType()))
-                return false;
-
-            writer.onHeaderWritten();
-        }
-
-        switch (writer.state()) {
-            case 3:
-                if (!writer.writeInt(grpId))
-                    return false;
-
-                writer.incrementState();
-
-        }
-
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
-        // TODO: Safe to remove only after all inheritors have migrated to the 
new ser/der scheme (IGNITE-25490).
-        reader.setBuffer(buf);
-
-        if (!super.readFrom(buf, reader))
-            return false;
-
-        switch (reader.state()) {
-            case 3:
-                grpId = reader.readInt();
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-        }
-
-        return true;
-    }
-
     /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(GridCacheGroupIdMessage.class, this);
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIdMessage.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIdMessage.java
index ec677b647d5..f0ebb72b7b5 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIdMessage.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIdMessage.java
@@ -17,12 +17,9 @@
 
 package org.apache.ignite.internal.processors.cache;
 
-import java.nio.ByteBuffer;
 import org.apache.ignite.internal.Order;
 import org.apache.ignite.internal.util.tostring.GridToStringInclude;
 import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.plugin.extensions.communication.MessageReader;
-import org.apache.ignite.plugin.extensions.communication.MessageWriter;
 
 /**
  * Message related to particular cache.
@@ -40,55 +37,6 @@ public abstract class GridCacheIdMessage extends 
GridCacheMessage {
         return cacheId;
     }
 
-    /** {@inheritDoc} */
-    @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
-        // TODO: Remove #writeTo() after all inheritors have migrated to the 
new ser/der scheme (IGNITE-25490).
-        writer.setBuffer(buf);
-
-        if (!super.writeTo(buf, writer))
-            return false;
-
-        if (!writer.isHeaderWritten()) {
-            if (!writer.writeHeader(directType()))
-                return false;
-
-            writer.onHeaderWritten();
-        }
-
-        switch (writer.state()) {
-            case 3:
-                if (!writer.writeInt(cacheId))
-                    return false;
-
-                writer.incrementState();
-
-        }
-
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
-        // TODO: Remove #readFrom() after all inheritors have migrated to the 
new ser/der scheme (IGNITE-25490).
-        reader.setBuffer(buf);
-
-        if (!super.readFrom(buf, reader))
-            return false;
-
-        switch (reader.state()) {
-            case 3:
-                cacheId = reader.readInt();
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-        }
-
-        return true;
-    }
-
     /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(GridCacheIdMessage.class, this, "super", 
super.toString());
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
index 1d50737d4f8..202c75834e8 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
@@ -830,11 +830,10 @@ public class GridCacheIoManager extends 
GridCacheSharedManagerAdapter {
                 GridDhtForceKeysResponse res = new GridDhtForceKeysResponse(
                     req.cacheId(),
                     req.futureId(),
-                    req.miniId()
+                    req.miniId(),
+                    req.classError()
                 );
 
-                res.error(req.classError());
-
                 sendResponseOnFailedMessage(nodeId, res, cctx, plc);
             }
 
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMessage.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMessage.java
index 285e4d392d9..ec670da2d1c 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMessage.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMessage.java
@@ -17,7 +17,6 @@
 
 package org.apache.ignite.internal.processors.cache;
 
-import java.nio.ByteBuffer;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
@@ -38,8 +37,6 @@ import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.marshaller.Marshaller;
 import org.apache.ignite.plugin.extensions.communication.Message;
-import org.apache.ignite.plugin.extensions.communication.MessageReader;
-import org.apache.ignite.plugin.extensions.communication.MessageWriter;
 import org.jetbrains.annotations.Nullable;
 
 /**
@@ -196,9 +193,9 @@ public abstract class GridCacheMessage implements Message {
     }
 
     /**
-     *  Deployment enabled flag indicates whether deployment info has to be 
added to this message.
+     * Deployment enabled flag indicates whether deployment info has to be 
added to this message.
      *
-     * @return {@code true} or if deployment info must be added to the the 
message, {@code false} otherwise.
+     * @return {@code true} or if deployment info must be added to the 
message, {@code false} otherwise.
      */
     public abstract boolean addDeploymentInfo();
 
@@ -641,77 +638,6 @@ public abstract class GridCacheMessage implements Message {
         return ctx.messageLogger();
     }
 
-    /** {@inheritDoc} */
-    @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
-        // TODO: Safe to remove only after all inheritors have migrated to the 
new ser/der scheme (IGNITE-25490).
-        writer.setBuffer(buf);
-
-        if (!writer.isHeaderWritten()) {
-            if (!writer.writeHeader(directType()))
-                return false;
-
-            writer.onHeaderWritten();
-        }
-
-        switch (writer.state()) {
-            case 0:
-                if (!writer.writeMessage(depInfo))
-                    return false;
-
-                writer.incrementState();
-
-            case 1:
-                if (!writer.writeAffinityTopologyVersion(lastAffChangedTopVer))
-                    return false;
-
-                writer.incrementState();
-
-            case 2:
-                if (!writer.writeLong(msgId))
-                    return false;
-
-                writer.incrementState();
-
-        }
-
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
-        // TODO: Safe to remove only after all inheritors have migrated to the 
new ser/der scheme (IGNITE-25490).
-        reader.setBuffer(buf);
-
-        switch (reader.state()) {
-            case 0:
-                depInfo = reader.readMessage();
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 1:
-                lastAffChangedTopVer = reader.readAffinityTopologyVersion();
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 2:
-                msgId = reader.readLong();
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-        }
-
-        return true;
-    }
-
     /**
      * @param str Bulder.
      * @param name Flag name.
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTxRecoveryResponse.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTxRecoveryResponse.java
index 2c7fe02b70c..51dc8059c1f 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTxRecoveryResponse.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTxRecoveryResponse.java
@@ -73,48 +73,21 @@ public class GridCacheTxRecoveryResponse extends 
GridDistributedBaseMessage impl
         this.addDepInfo = addDepInfo;
     }
 
-    /**
-     * @return Future ID.
-     */
+    /** @return Future ID. */
     public IgniteUuid futureId() {
         return futId;
     }
 
-    /**
-     * @param futId Future ID.
-     */
-    public void futureId(IgniteUuid futId) {
-        this.futId = futId;
-    }
-
-    /**
-     * @return Mini future ID.
-     */
+    /** @return Mini future ID. */
     public IgniteUuid miniId() {
         return miniId;
     }
 
-    /**
-     * @param miniId Mini future ID.
-     */
-    public void miniId(IgniteUuid miniId) {
-        this.miniId = miniId;
-    }
-
-    /**
-     * @return {@code True} if all remote transactions were prepared.
-     */
+    /** @return {@code True} if all remote transactions were prepared. */
     public boolean success() {
         return success;
     }
 
-    /**
-     * @param success {@code True} if all remote transactions were prepared.
-     */
-    public void success(boolean success) {
-        this.success = success;
-    }
-
     /** {@inheritDoc} */
     @Override public IgniteTxState txState() {
         return txState;
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockResponse.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockResponse.java
index 64da50ca22b..8327ad918c9 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockResponse.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockResponse.java
@@ -119,54 +119,16 @@ public class GridDistributedLockResponse extends 
GridDistributedBaseMessage {
         vals = new ArrayList<>(cnt);
     }
 
-    /**
-     *
-     * @return Future ID.
-     */
+    /** @return Future ID. */
     public IgniteUuid futureId() {
         return futId;
     }
 
-    /**
-     * @param futId New future ID.
-     */
-    public void futureId(IgniteUuid futId) {
-        this.futId = futId;
-    }
-
     /** {@inheritDoc} */
     @Override public Throwable error() {
         return ErrorMessage.error(errMsg);
     }
 
-    /**
-     * @return Error message.
-     */
-    public ErrorMessage errorMessage() {
-        return errMsg;
-    }
-
-    /**
-     * @param errMsg New error message.
-     */
-    public void errorMessage(ErrorMessage errMsg) {
-        this.errMsg = errMsg;
-    }
-
-    /**
-     * @return Values.
-     */
-    public List<CacheObject> values() {
-        return vals;
-    }
-
-    /**
-     * @param vals New values.
-     */
-    public void values(List<CacheObject> vals) {
-        this.vals = vals;
-    }
-
     /**
      * @param val Value.
      */
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareResponse.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareResponse.java
index 9bfbeb33c3f..94aecce2bf7 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareResponse.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareResponse.java
@@ -82,13 +82,6 @@ public class GridDistributedTxPrepareResponse extends 
GridDistributedBaseMessage
         return part;
     }
 
-    /**
-     * @param part New Partition ID this message is targeted to.
-     */
-    public void partition(int part) {
-        this.part = part;
-    }
-
     /** {@inheritDoc} */
     @Override @Nullable public Throwable error() {
         return ErrorMessage.error(errMsg);
@@ -122,20 +115,6 @@ public class GridDistributedTxPrepareResponse extends 
GridDistributedBaseMessage
         return 26;
     }
 
-    /**
-     * @return Error message.
-     */
-    public @Nullable ErrorMessage errorMessage() {
-        return errMsg;
-    }
-
-    /**
-     * @param errMsg New error message.
-     */
-    public void errorMessage(@Nullable ErrorMessage errMsg) {
-        this.errMsg = errMsg;
-    }
-
     /** {@inheritDoc} */
     @Override public String toString() {
         return 
GridToStringBuilder.toString(GridDistributedTxPrepareResponse.class, this, 
"err",
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
index a44bebc0d8d..7277db3ccd6 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
@@ -214,7 +214,8 @@ public abstract class GridDhtCacheAdapter<K, V> extends 
GridDistributedCacheAdap
             GridDhtForceKeysResponse res = new GridDhtForceKeysResponse(
                 ctx.cacheId(),
                 msg.futureId(),
-                msg.miniId());
+                msg.miniId(),
+                null);
 
             GridDhtPartitionTopology top = ctx.topology();
 
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockResponse.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockResponse.java
index 2e9a46f8708..4df50d7cb70 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockResponse.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockResponse.java
@@ -86,20 +86,11 @@ public class GridDhtLockResponse extends 
GridDistributedLockResponse {
         this.miniId = miniId;
     }
 
-    /**
-     * @return Mini future ID.
-     */
+    /** @return Mini future ID. */
     public IgniteUuid miniId() {
         return miniId;
     }
 
-    /**
-     * @param miniId New mini future ID.
-     */
-    public void miniId(IgniteUuid miniId) {
-        this.miniId = miniId;
-    }
-
     /**
      * @param part Invalid partition.
      */
@@ -110,20 +101,11 @@ public class GridDhtLockResponse extends 
GridDistributedLockResponse {
         invalidParts.add(part);
     }
 
-    /**
-     * @return Invalid partitions.
-     */
+    /** @return Invalid partitions. */
     public Collection<Integer> invalidPartitions() {
         return invalidParts;
     }
 
-    /**
-     * @param invalidParts New invalid partitions.
-     */
-    public void invalidPartitions(Collection<Integer> invalidParts) {
-        this.invalidParts = invalidParts;
-    }
-
     /**
      * Adds preload entry to lock response.
      *
@@ -136,20 +118,11 @@ public class GridDhtLockResponse extends 
GridDistributedLockResponse {
         preloadEntries.add(info);
     }
 
-    /**
-     * @return Preload entries returned from backup.
-     */
+    /** @return Preload entries returned from backup. */
     public Collection<GridCacheEntryInfo> preloadEntries() {
         return preloadEntries;
     }
 
-    /**
-     * @param preloadEntries New preload entries returned from backup.
-     */
-    public void preloadEntries(List<GridCacheEntryInfo> preloadEntries) {
-        this.preloadEntries = preloadEntries;
-    }
-
     /** {@inheritDoc} */
     @Override public void prepareMarshal(GridCacheSharedContext<?, ?> ctx) 
throws IgniteCheckedException {
         super.prepareMarshal(ctx);
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareResponse.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareResponse.java
index fa947fc4e54..50618064d58 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareResponse.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareResponse.java
@@ -126,34 +126,16 @@ public class GridDhtTxPrepareResponse extends 
GridDistributedTxPrepareResponse {
         this.nearEvicted = nearEvicted;
     }
 
-    /**
-     * @return Future ID.
-     */
+    /** @return Future ID. */
     public IgniteUuid futureId() {
         return futId;
     }
 
-    /**
-     * @param futId New future ID.
-     */
-    public void futureId(IgniteUuid futId) {
-        this.futId = futId;
-    }
-
-    /**
-     * @return Mini future ID.
-     */
+    /** @return Mini future ID. */
     public int miniId() {
         return miniId;
     }
 
-    /**
-     * @param miniId New mini future ID.
-     */
-    public void miniId(int miniId) {
-        this.miniId = miniId;
-    }
-
     /**
      * @return Invalid partitions by cache ID.
      */
@@ -168,20 +150,11 @@ public class GridDhtTxPrepareResponse extends 
GridDistributedTxPrepareResponse {
         this.invalidParts = invalidParts;
     }
 
-    /**
-     * @return Preload entries found on backup node.
-     */
+    /** @return Preload entries found on backup node. */
     public @Nullable Collection<GridCacheEntryInfo> preloadEntries() {
         return preloadEntries;
     }
 
-    /**
-     * @param preloadEntries New preload entries found on backup node.
-     */
-    public void preloadEntries(@Nullable List<GridCacheEntryInfo> 
preloadEntries) {
-        this.preloadEntries = preloadEntries;
-    }
-
     /**
      * Adds preload entry.
      *
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicDeferredUpdateResponse.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicDeferredUpdateResponse.java
index fa9947d3560..eb84c09dc2f 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicDeferredUpdateResponse.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicDeferredUpdateResponse.java
@@ -85,20 +85,11 @@ public class GridDhtAtomicDeferredUpdateResponse extends 
GridCacheIdMessage impl
         return false;
     }
 
-    /**
-     * @return List of ACKed future ids.
-     */
+    /** @return List of ACKed future ids. */
     public GridLongList futureIds() {
         return futIds;
     }
 
-    /**
-     * @param futIds New list of ACKed future ids.
-     */
-    public void futureIds(GridLongList futIds) {
-        this.futIds = futIds;
-    }
-
     /** {@inheritDoc} */
     @Override public IgniteLogger messageLogger(GridCacheSharedContext ctx) {
         return ctx.atomicMessageLogger();
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicNearResponse.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicNearResponse.java
index 5abd304a918..57524fb61f6 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicNearResponse.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicNearResponse.java
@@ -103,46 +103,21 @@ public class GridDhtAtomicNearResponse extends 
GridCacheIdMessage {
         this.errs = errs;
     }
 
-    /**
-     * @return Primary node ID.
-     */
+    /** @return Primary node ID. */
     public UUID primaryId() {
         return primaryId;
     }
 
-    /**
-     * @param primaryId Primary node ID.
-     */
-    public void primaryId(UUID primaryId) {
-        this.primaryId = primaryId;
-    }
-
-    /**
-     * @return Flags.
-     */
+    /** @return Flags. */
     public byte flags() {
         return flags;
     }
 
-    /**
-     * @param flags Flags.
-     */
-    public void flags(byte flags) {
-        this.flags = flags;
-    }
-
     /** {@inheritDoc} */
     @Override public int partition() {
         return partId;
     }
 
-    /**
-     * @param partId Partition ID.
-     */
-    public void partition(int partId) {
-        this.partId = partId;
-    }
-
     /**
      * @param key Key.
      * @param e Error.
@@ -180,20 +155,11 @@ public class GridDhtAtomicNearResponse extends 
GridCacheIdMessage {
         return (flags & mask) != 0;
     }
 
-    /**
-     * @return Future ID.
-     */
+    /** @return Future ID. */
     public long futureId() {
         return futId;
     }
 
-    /**
-     * @param futId Future ID.
-     */
-    public void futureId(long futId) {
-        this.futId = futId;
-    }
-
     /** {@inheritDoc} */
     @Override public int lookupIndex() {
         return CACHE_MSG_IDX;
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java
index 4787ca83b19..4fb32861b35 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java
@@ -77,34 +77,11 @@ public class GridDhtAtomicUpdateResponse extends 
GridCacheIdMessage implements G
         return CACHE_MSG_IDX;
     }
 
-    /**
-     * @return Future version.
-     */
+    /** @return Future version. */
     public long futureId() {
         return futId;
     }
 
-    /**
-     * @param futId New future version.
-     */
-    public void futureId(long futId) {
-        this.futId = futId;
-    }
-
-    /**
-     * @return Errors.
-     */
-    public UpdateErrors errors() {
-        return errs;
-    }
-
-    /**
-     * @param errs Errors.
-     */
-    public void errors(UpdateErrors errs) {
-        this.errs = errs;
-    }
-
     /**
      * Sets update error.
      *
@@ -141,13 +118,6 @@ public class GridDhtAtomicUpdateResponse extends 
GridCacheIdMessage implements G
         return partId;
     }
 
-    /**
-     * @param partId Partition.
-     */
-    public void partition(int partId) {
-        this.partId = partId;
-    }
-
     /** {@inheritDoc} */
     @Override public void prepareMarshal(GridCacheSharedContext ctx) throws 
IgniteCheckedException {
         super.prepareMarshal(ctx);
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java
index 8cf63149612..41574d370b9 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateResponse.java
@@ -147,34 +147,16 @@ public class GridNearAtomicUpdateResponse extends 
GridCacheIdMessage implements
         this.nodeId = nodeId;
     }
 
-    /**
-     * @return Future ID.
-     */
+    /** @return Future ID. */
     public long futureId() {
         return futId;
     }
 
-    /**
-     * @param futId New future ID.
-     */
-    public void futureId(long futId) {
-        this.futId = futId;
-    }
-
-    /**
-     * @return Errs.
-     */
+    /** @return Errs. */
     public UpdateErrors errors() {
         return errs;
     }
 
-    /**
-     * @param errs New errs.
-     */
-    public void errors(UpdateErrors errs) {
-        this.errs = errs;
-    }
-
     /**
      * Sets update error.
      *
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysResponse.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysResponse.java
index 2b739c38877..cfe7f9d32d3 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysResponse.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysResponse.java
@@ -72,23 +72,16 @@ public class GridDhtForceKeysResponse extends 
GridCacheIdMessage implements Grid
      * @param cacheId Cache ID.
      * @param futId Request id.
      * @param miniId Mini-future ID.
+     * @param err Error.
      */
-    public GridDhtForceKeysResponse(int cacheId, IgniteUuid futId, IgniteUuid 
miniId) {
+    public GridDhtForceKeysResponse(int cacheId, IgniteUuid futId, IgniteUuid 
miniId, IgniteCheckedException err) {
         assert futId != null;
         assert miniId != null;
 
         this.cacheId = cacheId;
         this.futId = futId;
         this.miniId = miniId;
-    }
-
-    /**
-     * Sets error.
-     *
-     * @param err Error.
-     */
-    public void error(IgniteCheckedException err) {
-        errorMessage(new ErrorMessage(err));
+        this.errMsg = new ErrorMessage(err);
     }
 
     /** {@inheritDoc} */
@@ -96,76 +89,26 @@ public class GridDhtForceKeysResponse extends 
GridCacheIdMessage implements Grid
         return ErrorMessage.error(errMsg);
     }
 
-    /**
-     * @return The error message.
-     */
-    @Nullable public ErrorMessage errorMessage() {
-        return errMsg;
-    }
-
-    /**
-     * Sets the error message.
-     *
-     * @param errMsg Error message.
-     */
-    public void errorMessage(@Nullable ErrorMessage errMsg) {
-        this.errMsg = errMsg;
-    }
-
-    /**
-     * @return Keys.
-     */
+    /** @return Keys. */
     public Collection<KeyCacheObject> missedKeys() {
         return F.emptyIfNull(missedKeys);
     }
 
-    /** @param missedKeys Missed keys. */
-    public void missedKeys(List<KeyCacheObject> missedKeys) {
-        this.missedKeys = missedKeys;
-    }
-
-    /**
-     * @return Forced entries.
-     */
+    /** @return Forced entries. */
     public Collection<GridCacheEntryInfo> forcedInfos() {
         return F.emptyIfNull(infos);
     }
 
-    /**
-     * @param infos Forced entries.
-     */
-    public void forcedInfos(List<GridCacheEntryInfo> infos) {
-        this.infos = infos;
-    }
-
-    /**
-     * @return Future ID.
-     */
+    /** @return Future ID. */
     public IgniteUuid futureId() {
         return futId;
     }
 
-    /**
-     * @param futId Future ID.
-     */
-    public void futureId(IgniteUuid futId) {
-        this.futId = futId;
-    }
-
-    /**
-     * @return Mini-future ID.
-     */
+    /** @return Mini-future ID. */
     public IgniteUuid miniId() {
         return miniId;
     }
 
-    /**
-     * @param miniId Mini-future ID.
-     */
-    public void miniId(IgniteUuid miniId) {
-        this.miniId = miniId;
-    }
-
     /**
      * @param key Key.
      */
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetResponse.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetResponse.java
index 0fec84749f5..654c94aedf5 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetResponse.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetResponse.java
@@ -101,46 +101,21 @@ public class GridNearGetResponse extends 
GridCacheIdMessage implements GridCache
         this.addDepInfo = addDepInfo;
     }
 
-    /**
-     * @return Future ID.
-     */
+    /** @return Future ID. */
     public IgniteUuid futureId() {
         return futId;
     }
 
-    /**
-     * @param futId Future ID.
-     */
-    public void futureId(IgniteUuid futId) {
-        this.futId = futId;
-    }
-
-    /**
-     * @return Sub ID.
-     */
+    /** @return Sub ID. */
     public IgniteUuid miniId() {
         return miniId;
     }
 
-    /**
-     * @param miniId Sub ID.
-     */
-    public void miniId(IgniteUuid miniId) {
-        this.miniId = miniId;
-    }
-
     /** {@inheritDoc} */
     @Override public GridCacheVersion version() {
         return ver;
     }
 
-    /**
-     * @param ver Version.
-     */
-    public void version(GridCacheVersion ver) {
-        this.ver = ver;
-    }
-
     /**
      * @return Entries.
      */
@@ -185,13 +160,6 @@ public class GridNearGetResponse extends 
GridCacheIdMessage implements GridCache
         return topVer != null ? topVer : super.topologyVersion();
     }
 
-    /**
-     * @param topVer Topology version if this response has invalid partitions.
-     */
-    public void topologyVersion(AffinityTopologyVersion topVer) {
-        this.topVer = topVer;
-    }
-
     /** {@inheritDoc} */
     @Override public @Nullable Throwable error() {
         return ErrorMessage.error(errMsg);
@@ -205,20 +173,6 @@ public class GridNearGetResponse extends 
GridCacheIdMessage implements GridCache
             errMsg = new ErrorMessage(err);
     }
 
-    /**
-     * @return Error message.
-     */
-    public @Nullable ErrorMessage errorMessage() {
-        return errMsg;
-    }
-
-    /**
-     * @param errMsg Error message.
-     */
-    public void errorMessage(@Nullable ErrorMessage errMsg) {
-        this.errMsg = errMsg;
-    }
-
     /** {@inheritDoc}
      * @param ctx*/
     @Override public void prepareMarshal(GridCacheSharedContext<?, ?> ctx) 
throws IgniteCheckedException {
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockResponse.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockResponse.java
index 16d3777ccc9..11c23b7f2c3 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockResponse.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockResponse.java
@@ -114,34 +114,16 @@ public class GridNearLockResponse extends 
GridDistributedLockResponse {
         this.compatibleRemapVer = compatibleRemapVer;
     }
 
-    /**
-     * @return Topology version, which is set when client node should remap 
lock request.
-     */
+    /** @return Topology version, which is set when client node should remap 
lock request. */
     @Nullable public AffinityTopologyVersion clientRemapVersion() {
         return clientRemapVer;
     }
 
-    /**
-     * @param clientRemapVer New topology version, which is set when client 
node should remap lock request.
-     */
-    public void clientRemapVersion(AffinityTopologyVersion clientRemapVer) {
-        this.clientRemapVer = clientRemapVer;
-    }
-
-    /**
-     * @return Flag, indicating whether remap version is compatible with 
current version.
-     */
+    /** @return Flag, indicating whether remap version is compatible with 
current version. */
     public boolean compatibleRemapVersion() {
         return compatibleRemapVer;
     }
 
-    /**
-     * @param compatibleRemapVer New flag, indicating whether remap version is 
compatible with current version.
-     */
-    public void compatibleRemapVersion(boolean compatibleRemapVer) {
-        this.compatibleRemapVer = compatibleRemapVer;
-    }
-
     /**
      * @return Pending versions that are less than {@link #version()}.
      */
@@ -156,20 +138,11 @@ public class GridNearLockResponse extends 
GridDistributedLockResponse {
         this.pending = pending;
     }
 
-    /**
-     * @return Mini future ID.
-     */
+    /** @return Mini future ID. */
     public int miniId() {
         return miniId;
     }
 
-    /**
-     * @param miniId New mini future ID.
-     */
-    public void miniId(int miniId) {
-        this.miniId = miniId;
-    }
-
     /**
      * @param idx Index.
      * @return DHT version.
@@ -178,20 +151,6 @@ public class GridNearLockResponse extends 
GridDistributedLockResponse {
         return dhtVers == null ? null : dhtVers[idx];
     }
 
-    /**
-     * @return DHT versions.
-     */
-    public GridCacheVersion[] dhtVersions() {
-        return dhtVers;
-    }
-
-    /**
-     * @param dhtVers New DHT versions.
-     */
-    public void dhtVersions(GridCacheVersion[] dhtVers) {
-        this.dhtVers = dhtVers;
-    }
-
     /**
      * Returns DHT candidate version for acquired near lock on DHT node.
      *
@@ -202,20 +161,6 @@ public class GridNearLockResponse extends 
GridDistributedLockResponse {
         return mappedVers == null ? null : mappedVers[idx];
     }
 
-    /**
-     * @return DHT candidate versions.
-     */
-    public GridCacheVersion[] mappedVersions() {
-        return mappedVers;
-    }
-
-    /**
-     * @param mappedVers New DHT candidate versions.
-     */
-    public void mappedVersions(GridCacheVersion[] mappedVers) {
-        this.mappedVers = mappedVers;
-    }
-
     /**
      * Gets filter evaluation result for fast-commit transaction.
      *
@@ -228,20 +173,6 @@ public class GridNearLockResponse extends 
GridDistributedLockResponse {
         return filterRes[idx];
     }
 
-    /**
-     * @return Filter evaluation results for fast-commit transactions.
-     */
-    public boolean[] filterResults() {
-        return filterRes;
-    }
-
-    /**
-     * @param filterRes New filter evaluation results for fast-commit 
transactions.
-     */
-    public void filterResults(boolean[] filterRes) {
-        this.filterRes = filterRes;
-    }
-
     /**
      * @param val Value.
      * @param filterPassed Boolean flag indicating whether filter passed for 
fast-commit transaction.
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearSingleGetResponse.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearSingleGetResponse.java
index c3c73676c98..db0941b14ff 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearSingleGetResponse.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearSingleGetResponse.java
@@ -106,20 +106,6 @@ public class GridNearSingleGetResponse extends 
GridCacheIdMessage implements Gri
         return ErrorMessage.error(errMsg);
     }
 
-    /**
-     * @return Error message.
-     */
-    public ErrorMessage errorMessage() {
-        return errMsg;
-    }
-
-    /**
-     * @param errMsg Error message.
-     */
-    public void errorMessage(ErrorMessage errMsg) {
-        this.errMsg = errMsg;
-    }
-
     /**
      * @return Topology version.
      */
@@ -148,48 +134,16 @@ public class GridNearSingleGetResponse extends 
GridCacheIdMessage implements Gri
         flags |= CONTAINS_VAL_FLAG_MASK;
     }
 
-    /**
-     * @return Flags.
-     */
-    public byte flags() {
-        return flags;
-    }
-
-    /**
-     * @param flags Flags.
-     */
-    public void flags(byte flags) {
-        this.flags = flags;
-    }
-
-    /**
-     * @return Result.
-     */
+    /** @return Result. */
     public Message result() {
         return res;
     }
 
-    /**
-     * @param res Result.
-     */
-    public void result(Message res) {
-        this.res = res;
-    }
-
-    /**
-     * @return Future ID.
-     */
+    /** @return Future ID. */
     public long futureId() {
         return futId;
     }
 
-    /**
-     * @param futId Future ID.
-     */
-    public void futureId(long futId) {
-        this.futId = futId;
-    }
-
     /** {@inheritDoc} */
     @Override public void prepareMarshal(GridCacheSharedContext<?, ?> ctx) 
throws IgniteCheckedException {
         super.prepareMarshal(ctx);
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishResponse.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishResponse.java
index 5cb53e7d946..718c5171eee 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishResponse.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishResponse.java
@@ -77,48 +77,11 @@ public final class GridNearTxFinishResponse extends 
GridDistributedTxFinishRespo
         return ErrorMessage.error(errMsg);
     }
 
-    /**
-     * @return Mini future ID.
-     */
+    /** @return Mini future ID. */
     public int miniId() {
         return miniId;
     }
 
-    /**
-     * Sets mini future ID.
-     */
-    public void miniId(int miniId) {
-        this.miniId = miniId;
-    }
-
-    /**
-     * @return Near thread ID.
-     */
-    public long threadId() {
-        return nearThreadId;
-    }
-
-    /**
-     * Sets near thread ID.
-     */
-    public void threadId(long nearThreadId) {
-        this.nearThreadId = nearThreadId;
-    }
-
-    /**
-     * @return Error message.
-     */
-    public @Nullable ErrorMessage errorMessage() {
-        return errMsg;
-    }
-
-    /**
-     * Sets error message.
-     */
-    public void errorMessage(@Nullable ErrorMessage errMsg) {
-        this.errMsg = errMsg;
-    }
-
     /** {@inheritDoc} */
     @Override public short directType() {
         return 54;
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponse.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponse.java
index 15be184ccca..57039e829fb 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponse.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponse.java
@@ -138,34 +138,16 @@ public class GridNearTxPrepareResponse extends 
GridDistributedTxPrepareResponse
         this.onePhaseCommit = onePhaseCommit;
     }
 
-    /**
-     * @return One-phase commit on primary flag.
-     */
+    /** @return One-phase commit on primary flag. */
     public boolean onePhaseCommit() {
         return onePhaseCommit;
     }
 
-    /**
-     * @param onePhaseCommit New one-phase commit on primary flag.
-     */
-    public void onePhaseCommit(boolean onePhaseCommit) {
-        this.onePhaseCommit = onePhaseCommit;
-    }
-
-    /**
-     * @return Topology version, which is set when client node should remap 
lock request.
-     */
+    /** @return Topology version, which is set when client node should remap 
lock request. */
     @Nullable public AffinityTopologyVersion clientRemapVersion() {
         return clientRemapVer;
     }
 
-    /**
-     * @param clientRemapVer New topology version, which is set when client 
node should remap lock request.
-     */
-    public void clientRemapVersion(@Nullable AffinityTopologyVersion 
clientRemapVer) {
-        this.clientRemapVer = clientRemapVer;
-    }
-
     /**
      * @return Versions that are less than lock version ({@link #version()}).
      */
@@ -180,62 +162,26 @@ public class GridNearTxPrepareResponse extends 
GridDistributedTxPrepareResponse
         this.pending = pending;
     }
 
-    /**
-     * @return Mini future ID.
-     */
+    /** @return Mini future ID. */
     public int miniId() {
         return miniId;
     }
 
-    /**
-     * @param miniId New mini future ID.
-     */
-    public void miniId(int miniId) {
-        this.miniId = miniId;
-    }
-
-    /**
-     * @return Future ID.
-     */
+    /** @return Future ID. */
     public IgniteUuid futureId() {
         return futId;
     }
 
-    /**
-     * @param futId New future ID.
-     */
-    public void futureId(IgniteUuid futId) {
-        this.futId = futId;
-    }
-
-    /**
-     * @return DHT version.
-     */
+    /** @return DHT version. */
     public GridCacheVersion dhtVersion() {
         return dhtVer;
     }
 
-    /**
-     * @param dhtVer New DHT version.
-     */
-    public void dhtVersion(GridCacheVersion dhtVer) {
-        this.dhtVer = dhtVer;
-    }
-
-    /**
-     * @return Write version.
-     */
+    /** @return Write version. */
     public GridCacheVersion writeVersion() {
         return writeVer;
     }
 
-    /**
-     * @param writeVer New write version.
-     */
-    public void writeVersion(GridCacheVersion writeVer) {
-        this.writeVer = writeVer;
-    }
-
     /**
      * Adds owned value.
      *
@@ -262,20 +208,11 @@ public class GridNearTxPrepareResponse extends 
GridDistributedTxPrepareResponse
         return ownedVals == null ? Collections.emptyMap() : 
Collections.unmodifiableMap(ownedVals);
     }
 
-    /**
-     * @return Cache return value.
-     */
+    /** @return Cache return value. */
     public GridCacheReturn returnValue() {
         return retVal;
     }
 
-    /**
-     * @param retVal New cache return value.
-     */
-    public void returnValue(GridCacheReturn retVal) {
-        this.retVal = retVal;
-    }
-
     /**
      * @param filterFailedKeys Keys that did not pass the filter.
      */
@@ -298,34 +235,6 @@ public class GridNearTxPrepareResponse extends 
GridDistributedTxPrepareResponse
         return F.mapContainsKey(ownedVals, key);
     }
 
-    /**
-     * @return OwnedVals' keys for marshalling.
-     */
-    public @Nullable Collection<IgniteTxKey> ownedValuesKeys() {
-        return ownedValKeys;
-    }
-
-    /**
-     * @param ownedValKeys New ownedVals' keys for marshalling.
-     */
-    public void ownedValuesKeys(@Nullable Collection<IgniteTxKey> 
ownedValKeys) {
-        this.ownedValKeys = ownedValKeys;
-    }
-
-    /**
-     * @return OwnedVals' values for marshalling.
-     */
-    public @Nullable Collection<CacheVersionedValue> ownedValuesValues() {
-        return ownedValVals;
-    }
-
-    /**
-     * @param ownedValVals New ownedVals' values for marshalling.
-     */
-    public void ownedValuesValues(@Nullable Collection<CacheVersionedValue> 
ownedValVals) {
-        this.ownedValVals = ownedValVals;
-    }
-
     /** {@inheritDoc} */
     @Override public void prepareMarshal(GridCacheSharedContext<?, ?> ctx) 
throws IgniteCheckedException {
         super.prepareMarshal(ctx);
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryResponse.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryResponse.java
index b858725a6b0..f811e065005 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryResponse.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryResponse.java
@@ -209,30 +209,11 @@ public class GridCacheQueryResponse extends 
GridCacheIdMessage implements GridCa
         this.data = (Collection<Object>)data;
     }
 
-    /**
-     * @return If this is last response for this request or not.
-     */
+    /** @return If this is last response for this request or not. */
     public boolean finished() {
         return finished;
     }
 
-    /**
-     * @param finished If this is last response for this request or not.
-     */
-    public void finished(boolean finished) {
-        this.finished = finished;
-    }
-
-    /** */
-    public Collection<byte[]> dataBytes() {
-        return dataBytes;
-    }
-
-    /** */
-    public void dataBytes(Collection<byte[]> dataBytes) {
-        this.dataBytes = dataBytes;
-    }
-
     /**
      * @return Request id.
      */
@@ -240,31 +221,11 @@ public class GridCacheQueryResponse extends 
GridCacheIdMessage implements GridCa
         return reqId;
     }
 
-    /** */
-    public void requestId(long reqId) {
-        this.reqId = reqId;
-    }
-
     /** {@inheritDoc} */
     @Override public @Nullable Throwable error() {
         return ErrorMessage.error(errMsg);
     }
 
-    /** */
-    public @Nullable ErrorMessage errorMessage() {
-        return errMsg;
-    }
-
-    /** */
-    public void errorMessage(@Nullable ErrorMessage errMsg) {
-        this.errMsg = errMsg;
-    }
-
-    /** */
-    public void fields(boolean fields) {
-        this.fields = fields;
-    }
-
     /**
      * @return If fields query.
      */
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryBatchAck.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryBatchAck.java
index 8f0b348e833..44be8368748 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryBatchAck.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryBatchAck.java
@@ -62,27 +62,11 @@ public class CacheContinuousQueryBatchAck extends 
GridCacheIdMessage {
         return routineId;
     }
 
-    /**
-     * @param routineId Routine ID.
-     */
-    public void routineId(UUID routineId) {
-        this.routineId = routineId;
-    }
-
-    /**
-     * @return Update counters.
-     */
-    public Map<Integer, Long> updateCntrs() {
+    /** @return Update counters. */
+    public Map<Integer, Long> updateCounters() {
         return updateCntrs;
     }
 
-    /**
-     * @param updateCntrs Update counters.
-     */
-    public void updateCntrs(Map<Integer, Long> updateCntrs) {
-        this.updateCntrs = updateCntrs;
-    }
-
     /** {@inheritDoc} */
     @Override public boolean addDeploymentInfo() {
         return false;
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java
index 1d388a08814..922e4203af3 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryManager.java
@@ -177,7 +177,7 @@ public class CacheContinuousQueryManager<K, V> extends 
GridCacheManagerAdapter<K
                         CacheContinuousQueryListener lsnr = 
lsnrs.get(msg.routineId());
 
                         if (lsnr != null)
-                            lsnr.cleanupOnAck(msg.updateCntrs());
+                            lsnr.cleanupOnAck(msg.updateCounters());
                     }
                 });
 
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/util/nio/TcpCommunicationSpiSslVolatilePayloadTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/util/nio/TcpCommunicationSpiSslVolatilePayloadTest.java
index 9533c154c22..9be2ee31560 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/util/nio/TcpCommunicationSpiSslVolatilePayloadTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/util/nio/TcpCommunicationSpiSslVolatilePayloadTest.java
@@ -18,7 +18,6 @@
 package org.apache.ignite.internal.util.nio;
 
 import java.util.Arrays;
-import java.util.Collections;
 import java.util.Map;
 import java.util.UUID;
 import java.util.concurrent.ConcurrentHashMap;
@@ -26,16 +25,17 @@ import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.ThreadLocalRandom;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicInteger;
-import java.util.function.Supplier;
 import org.apache.ignite.cluster.ClusterNode;
 import org.apache.ignite.internal.util.nio.ssl.BlockingSslHandler;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.lang.IgniteRunnable;
 import org.apache.ignite.plugin.extensions.communication.Message;
+import 
org.apache.ignite.plugin.extensions.communication.MessageFactoryProvider;
 import org.apache.ignite.spi.communication.CommunicationListener;
 import org.apache.ignite.spi.communication.CommunicationSpi;
 import org.apache.ignite.spi.communication.GridAbstractCommunicationSelfTest;
 import org.apache.ignite.spi.communication.TestVolatilePayloadMessage;
+import 
org.apache.ignite.spi.communication.TestVolatilePayloadMessageSerializer;
 import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
 import org.apache.ignite.spi.communication.tcp.internal.GridNioServerWrapper;
 import 
org.apache.ignite.spi.communication.tcp.messages.RecoveryLastReceivedMessage;
@@ -94,8 +94,10 @@ public class TcpCommunicationSpiSslVolatilePayloadTest 
extends GridAbstractCommu
     }
 
     /** {@inheritDoc} */
-    @Override protected Map<Short, Supplier<Message>> customMessageTypes() {
-        return 
Collections.singletonMap(TestVolatilePayloadMessage.DIRECT_TYPE, 
TestVolatilePayloadMessage::new);
+    @Override protected MessageFactoryProvider customMessageFactory() {
+        return f -> f.register(
+            TestVolatilePayloadMessage.DIRECT_TYPE, 
TestVolatilePayloadMessage::new, new TestVolatilePayloadMessageSerializer()
+        );
     }
 
     /** {@inheritDoc} */
diff --git 
a/modules/core/src/test/java/org/apache/ignite/spi/communication/GridAbstractCommunicationSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/spi/communication/GridAbstractCommunicationSelfTest.java
index b2b94378e98..b6256b6dc7c 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/spi/communication/GridAbstractCommunicationSelfTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/spi/communication/GridAbstractCommunicationSelfTest.java
@@ -25,7 +25,6 @@ import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.UUID;
-import java.util.function.Supplier;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.cluster.ClusterNode;
 import org.apache.ignite.configuration.IgniteConfiguration;
@@ -35,7 +34,6 @@ import 
org.apache.ignite.internal.processors.timeout.GridTimeoutProcessor;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.plugin.extensions.communication.Message;
-import org.apache.ignite.plugin.extensions.communication.MessageFactory;
 import 
org.apache.ignite.plugin.extensions.communication.MessageFactoryProvider;
 import org.apache.ignite.spi.IgniteSpiAdapter;
 import org.apache.ignite.testframework.GridSpiTestContext;
@@ -81,7 +79,7 @@ public abstract class GridAbstractCommunicationSelfTest<T 
extends CommunicationS
     protected abstract CommunicationListener<Message> 
createMessageListener(UUID nodeId);
 
     /** */
-    protected abstract Map<Short, Supplier<Message>> customMessageTypes();
+    protected abstract MessageFactoryProvider customMessageFactory();
 
     /** */
     protected boolean isSslEnabled() {
@@ -155,14 +153,8 @@ public abstract class GridAbstractCommunicationSelfTest<T 
extends CommunicationS
 
             GridSpiTestContext ctx = initSpiContext();
 
-            MessageFactoryProvider testMsgFactory = new 
MessageFactoryProvider() {
-                @Override public void registerAll(MessageFactory factory) {
-                    customMessageTypes().forEach(factory::register);
-                }
-            };
-
             ctx.messageFactory(new IgniteMessageFactoryImpl(new 
MessageFactoryProvider[] {
-                new GridIoMessageFactory(jdk(), U.gridClassLoader()), 
testMsgFactory}));
+                new GridIoMessageFactory(jdk(), U.gridClassLoader()), 
customMessageFactory()}));
 
             ctx.setLocalNode(node);
 
diff --git 
a/modules/core/src/test/java/org/apache/ignite/spi/communication/GridCacheMessageSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/spi/communication/GridCacheMessageSelfTest.java
index 6acfc4c101c..53570527138 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/spi/communication/GridCacheMessageSelfTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/spi/communication/GridCacheMessageSelfTest.java
@@ -17,8 +17,6 @@
 
 package org.apache.ignite.spi.communication;
 
-import java.nio.ByteBuffer;
-import java.util.ArrayList;
 import java.util.Collection;
 import java.util.UUID;
 import java.util.concurrent.CountDownLatch;
@@ -30,7 +28,6 @@ import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.failure.AbstractFailureHandler;
 import org.apache.ignite.failure.FailureContext;
-import org.apache.ignite.internal.GridDirectCollection;
 import org.apache.ignite.internal.IgniteEx;
 import org.apache.ignite.internal.managers.communication.GridIoManager;
 import org.apache.ignite.internal.managers.communication.GridIoPolicy;
@@ -40,14 +37,7 @@ import org.apache.ignite.internal.util.typedef.CI2;
 import org.apache.ignite.plugin.AbstractTestPluginProvider;
 import org.apache.ignite.plugin.ExtensionRegistry;
 import org.apache.ignite.plugin.PluginContext;
-import org.apache.ignite.plugin.extensions.communication.Message;
-import 
org.apache.ignite.plugin.extensions.communication.MessageCollectionItemType;
-import org.apache.ignite.plugin.extensions.communication.MessageCollectionType;
-import org.apache.ignite.plugin.extensions.communication.MessageFactory;
 import 
org.apache.ignite.plugin.extensions.communication.MessageFactoryProvider;
-import org.apache.ignite.plugin.extensions.communication.MessageItemType;
-import org.apache.ignite.plugin.extensions.communication.MessageReader;
-import org.apache.ignite.plugin.extensions.communication.MessageWriter;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 import org.junit.Test;
 
@@ -221,476 +211,6 @@ public class GridCacheMessageSelfTest extends 
GridCommonAbstractTest {
         assert latch.await(3, SECONDS);
     }
 
-    /** */
-    private static class TestMessage extends GridCacheMessage {
-        /** */
-        public static final short DIRECT_TYPE = 202;
-
-        /** */
-        @GridDirectCollection(TestMessage1.class)
-        private Collection<TestMessage1> entries = new ArrayList<>();
-
-        /**
-         * @param entry Entry.
-         */
-        public void add(TestMessage1 entry) {
-            entries.add(entry);
-        }
-
-        /** {@inheritDoc} */
-        @Override public boolean addDeploymentInfo() {
-            return false;
-        }
-
-        /**
-         * @return COllection of test messages.
-         */
-        public Collection<TestMessage1> entries() {
-            return entries;
-        }
-
-        /** {@inheritDoc} */
-        @Override public short directType() {
-            return DIRECT_TYPE;
-        }
-
-        /** {@inheritDoc} */
-        @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) 
{
-            writer.setBuffer(buf);
-
-            if (!super.writeTo(buf, writer))
-                return false;
-
-            if (!writer.isHeaderWritten()) {
-                if (!writer.writeHeader(directType()))
-                    return false;
-
-                writer.onHeaderWritten();
-            }
-
-            switch (writer.state()) {
-                case 3:
-                    if (!writer.writeCollection(entries,
-                        new MessageCollectionType(new 
MessageItemType(MessageCollectionItemType.MSG), false)))
-                        return false;
-
-                    writer.incrementState();
-
-            }
-
-            return true;
-        }
-
-        /** {@inheritDoc} */
-        @Override public boolean readFrom(ByteBuffer buf, MessageReader 
reader) {
-            reader.setBuffer(buf);
-
-            if (!super.readFrom(buf, reader))
-                return false;
-
-            switch (reader.state()) {
-                case 3:
-                    entries = reader.readCollection(new 
MessageCollectionType(new MessageItemType(MessageCollectionItemType.MSG), 
false));
-
-                    if (!reader.isLastRead())
-                        return false;
-
-                    reader.incrementState();
-
-            }
-
-            return true;
-        }
-    }
-
-    /**
-    * Test message class.
-    */
-    static class TestMessage1 extends GridCacheMessage {
-        /** */
-        public static final short DIRECT_TYPE = 203;
-
-        /** Body. */
-        private String body;
-
-        /** */
-        private Message msg;
-
-        /**
-         * @param msg Message.
-         * @param body Message body.
-         */
-        public void init(Message msg, String body) {
-            this.msg = msg;
-            this.body = body;
-        }
-
-        /** {@inheritDoc} */
-        @Override public boolean addDeploymentInfo() {
-            return false;
-        }
-
-        /**
-         * @return Body.
-         */
-        public String body() {
-            return body;
-        }
-
-        /**
-         * @return Message.
-         */
-        public Message message() {
-            return msg;
-        }
-
-        /** {@inheritDoc} */
-        @Override public short directType() {
-            return DIRECT_TYPE;
-        }
-
-        /** {@inheritDoc} */
-        @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) 
{
-            writer.setBuffer(buf);
-
-            if (!super.writeTo(buf, writer))
-                return false;
-
-            if (!writer.isHeaderWritten()) {
-                if (!writer.writeHeader(directType()))
-                    return false;
-
-                writer.onHeaderWritten();
-            }
-
-            switch (writer.state()) {
-                case 3:
-                    if (!writer.writeString(body))
-                        return false;
-
-                    writer.incrementState();
-
-                case 4:
-                    if (!writer.writeMessage(msg))
-                        return false;
-
-                    writer.incrementState();
-
-            }
-
-            return true;
-        }
-
-        /** {@inheritDoc} */
-        @Override public boolean readFrom(ByteBuffer buf, MessageReader 
reader) {
-            reader.setBuffer(buf);
-
-            if (!super.readFrom(buf, reader))
-                return false;
-
-            switch (reader.state()) {
-                case 3:
-                    body = reader.readString();
-
-                    if (!reader.isLastRead())
-                        return false;
-
-                    reader.incrementState();
-
-                case 4:
-                    msg = reader.readMessage();
-
-                    if (!reader.isLastRead())
-                        return false;
-
-                    reader.incrementState();
-
-            }
-
-            return true;
-        }
-    }
-
-    /**
-     * Test message class.
-     */
-    static class TestMessage2 extends GridCacheMessage {
-        /** */
-        public static final short DIRECT_TYPE = 201;
-
-        /** Node id. */
-        private UUID nodeId;
-
-        /** Integer field. */
-        private int id;
-
-        /** Body. */
-        private String body;
-
-        /** */
-        private Message msg;
-
-        /**
-         * @param mes Message.
-         */
-        public void init(Message mes, UUID nodeId, int id, String body) {
-            this.nodeId = nodeId;
-            this.id = id;
-            this.msg = mes;
-            this.body = body;
-        }
-
-        /** {@inheritDoc} */
-        @Override public boolean addDeploymentInfo() {
-            return false;
-        }
-
-        /**
-         * @return Body.
-         */
-        public String body() {
-            return body;
-        }
-
-        /**
-         * @return Message.
-         */
-        public Message message() {
-            return msg;
-        }
-
-        /**
-         * @return Node id.
-         */
-        public UUID nodeId() {
-            return nodeId;
-        }
-
-        /**
-         * @return Id.
-         */
-        public int id() {
-            return id;
-        }
-
-        /** {@inheritDoc} */
-        @Override public short directType() {
-            return DIRECT_TYPE;
-        }
-
-        /** {@inheritDoc} */
-        @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) 
{
-            writer.setBuffer(buf);
-
-            if (!super.writeTo(buf, writer))
-                return false;
-
-            if (!writer.isHeaderWritten()) {
-                if (!writer.writeHeader(directType()))
-                    return false;
-
-                writer.onHeaderWritten();
-            }
-
-            switch (writer.state()) {
-                case 3:
-                    if (!writer.writeUuid(nodeId))
-                        return false;
-
-                    writer.incrementState();
-
-                case 4:
-                    if (!writer.writeInt(id))
-                        return false;
-
-                    writer.incrementState();
-
-                case 5:
-                    if (!writer.writeString(body))
-                        return false;
-
-                    writer.incrementState();
-
-                case 6:
-                    if (!writer.writeMessage(msg))
-                        return false;
-
-                    writer.incrementState();
-            }
-
-            return true;
-        }
-
-        /** {@inheritDoc} */
-        @Override public boolean readFrom(ByteBuffer buf, MessageReader 
reader) {
-            reader.setBuffer(buf);
-
-            if (!super.readFrom(buf, reader))
-                return false;
-
-            switch (reader.state()) {
-                case 3:
-                    nodeId = reader.readUuid();
-
-                    if (!reader.isLastRead())
-                        return false;
-
-                    reader.incrementState();
-
-                case 4:
-                    id = reader.readInt();
-
-                    if (!reader.isLastRead())
-                        return false;
-
-                    reader.incrementState();
-
-                case 5:
-                    body = reader.readString();
-
-                    if (!reader.isLastRead())
-                        return false;
-
-                    reader.incrementState();
-
-                case 6:
-                    msg = reader.readMessage();
-
-                    if (!reader.isLastRead())
-                        return false;
-
-                    reader.incrementState();
-
-            }
-
-            return true;
-        }
-    }
-
-    /**
-     * Test message class.
-     */
-    static class TestBadMessage extends GridCacheMessage {
-        /** */
-        public static final short DIRECT_TYPE = 204;
-
-        /** Node id. */
-        private UUID nodeId;
-
-        /** Integer field. */
-        private int id;
-
-        /** Body. */
-        private String body;
-
-        /** */
-        private Message msg;
-
-        /** {@inheritDoc} */
-        @Override public boolean addDeploymentInfo() {
-            return false;
-        }
-
-        /** {@inheritDoc} */
-        @Override public short directType() {
-            return DIRECT_TYPE;
-        }
-
-        /** {@inheritDoc} */
-        @Override public String toString() {
-            throw new RuntimeException("Exception while log message");
-        }
-
-        /** {@inheritDoc} */
-        @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) 
{
-            writer.setBuffer(buf);
-
-            if (!super.writeTo(buf, writer))
-                return false;
-
-            if (!writer.isHeaderWritten()) {
-                if (!writer.writeHeader(directType()))
-                    return false;
-
-                writer.onHeaderWritten();
-            }
-
-            switch (writer.state()) {
-                case 3:
-                    if (!writer.writeUuid(nodeId))
-                        return false;
-
-                    writer.incrementState();
-
-                case 4:
-                    if (!writer.writeInt(id))
-                        return false;
-
-                    writer.incrementState();
-
-                case 5:
-                    if (!writer.writeString(body))
-                        return false;
-
-                    writer.incrementState();
-
-                case 6:
-                    if (!writer.writeMessage(msg))
-                        return false;
-
-                    writer.incrementState();
-
-            }
-
-            return true;
-        }
-
-        /** {@inheritDoc} */
-        @Override public boolean readFrom(ByteBuffer buf, MessageReader 
reader) {
-            reader.setBuffer(buf);
-
-            if (!super.readFrom(buf, reader))
-                return false;
-
-            switch (reader.state()) {
-                case 3:
-                    nodeId = reader.readUuid();
-
-                    if (!reader.isLastRead())
-                        return false;
-
-                    reader.incrementState();
-
-                case 4:
-                    id = reader.readInt();
-
-                    if (!reader.isLastRead())
-                        return false;
-
-                    reader.incrementState();
-
-                case 5:
-                    body = reader.readString();
-
-                    if (!reader.isLastRead())
-                        return false;
-
-                    reader.incrementState();
-
-                case 6:
-                    msg = reader.readMessage();
-
-                    if (!reader.isLastRead())
-                        return false;
-
-                    reader.incrementState();
-
-            }
-
-            return true;
-        }
-    }
-
     /** */
     private static class TestFailureHandler extends AbstractFailureHandler {
         /** {@inheritDoc} */
@@ -710,14 +230,12 @@ public class GridCacheMessageSelfTest extends 
GridCommonAbstractTest {
 
         /** {@inheritDoc} */
         @Override public void initExtensions(PluginContext ctx, 
ExtensionRegistry registry) {
-            registry.registerExtension(MessageFactoryProvider.class, new 
MessageFactoryProvider() {
-                @Override public void registerAll(MessageFactory factory) {
-                    factory.register(TestMessage.DIRECT_TYPE, 
TestMessage::new);
-                    factory.register(GridTestMessage.DIRECT_TYPE, 
GridTestMessage::new);
-                    factory.register(TestMessage1.DIRECT_TYPE, 
TestMessage1::new);
-                    factory.register(TestMessage2.DIRECT_TYPE, 
TestMessage2::new);
-                    factory.register(TestBadMessage.DIRECT_TYPE, 
TestBadMessage::new);
-                }
+            registry.registerExtension(MessageFactoryProvider.class, factory 
-> {
+                factory.register(TestMessage.DIRECT_TYPE, TestMessage::new, 
new TestMessageSerializer());
+                factory.register(GridTestMessage.DIRECT_TYPE, 
GridTestMessage::new, new GridTestMessageSerializer());
+                factory.register(TestMessage1.DIRECT_TYPE, TestMessage1::new, 
new TestMessage1Serializer());
+                factory.register(TestMessage2.DIRECT_TYPE, TestMessage2::new, 
new TestMessage2Serializer());
+                factory.register(TestBadMessage.DIRECT_TYPE, 
TestBadMessage::new, new TestBadMessageSerializer());
             });
         }
     }
diff --git 
a/modules/core/src/test/java/org/apache/ignite/spi/communication/GridTestMessage.java
 
b/modules/core/src/test/java/org/apache/ignite/spi/communication/GridTestMessage.java
index 2e096ae06c6..83a6ea91775 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/spi/communication/GridTestMessage.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/spi/communication/GridTestMessage.java
@@ -17,12 +17,11 @@
 
 package org.apache.ignite.spi.communication;
 
-import java.nio.ByteBuffer;
 import java.util.Objects;
 import java.util.UUID;
+import org.apache.ignite.internal.Order;
 import org.apache.ignite.plugin.extensions.communication.Message;
-import org.apache.ignite.plugin.extensions.communication.MessageReader;
-import org.apache.ignite.plugin.extensions.communication.MessageWriter;
+import 
org.apache.ignite.plugin.extensions.communication.MessageFactoryProvider;
 
 /**
  * Test message for communication SPI tests.
@@ -32,16 +31,24 @@ public class GridTestMessage implements Message {
     public static final short DIRECT_TYPE = 200;
 
     /** */
-    private UUID srcNodeId;
+    public static final MessageFactoryProvider GRID_TEST_MESSAGE_FACTORY = f 
-> f.register(
+        GridTestMessage.DIRECT_TYPE, GridTestMessage::new, new 
GridTestMessageSerializer());
 
     /** */
-    private long msgId;
+    @Order(0)
+    UUID srcNodeId;
 
     /** */
-    private long resId;
+    @Order(1)
+    long msgId;
+
+    /** */
+    @Order(2)
+    long resId;
 
     /** Network payload */
-    private byte[] payload;
+    @Order(3)
+    byte[] payload;
 
     /** */
     public GridTestMessage() {
@@ -59,108 +66,21 @@ public class GridTestMessage implements Message {
         this.resId = resId;
     }
 
-    /**
-     * @return Id of message originator.
-     */
+    /** @return Id of message originator. */
     public UUID getSourceNodeId() {
         return srcNodeId;
     }
 
-    /**
-     * @return Message sequence id.
-     */
+    /** @return Message sequence id. */
     public long getMsgId() {
         return msgId;
     }
 
-    /**
-     * @param payload Payload to be set.
-     */
+    /** @param payload Payload to be set. */
     public void payload(byte[] payload) {
         this.payload = payload;
     }
 
-    /** {@inheritDoc} */
-    @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
-        writer.setBuffer(buf);
-
-        if (!writer.isHeaderWritten()) {
-            if (!writer.writeHeader(directType()))
-                return false;
-
-            writer.onHeaderWritten();
-        }
-
-        switch (writer.state()) {
-            case 0:
-                if (!writer.writeUuid(srcNodeId))
-                    return false;
-
-                writer.incrementState();
-
-            case 1:
-                if (!writer.writeLong(msgId))
-                    return false;
-
-                writer.incrementState();
-
-            case 2:
-                if (!writer.writeLong(resId))
-                    return false;
-
-                writer.incrementState();
-
-            case 3:
-                if (!writer.writeByteArray(payload))
-                    return false;
-
-                writer.incrementState();
-        }
-
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
-        reader.setBuffer(buf);
-
-        switch (reader.state()) {
-            case 0:
-                srcNodeId = reader.readUuid();
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 1:
-                msgId = reader.readLong();
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 2:
-                resId = reader.readLong();
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 3:
-                payload = reader.readByteArray();
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-        }
-
-        return true;
-    }
-
     /** {@inheritDoc} */
     @Override public short directType() {
         return DIRECT_TYPE;
diff --git 
a/modules/core/src/test/java/org/apache/ignite/spi/communication/TestBadMessage.java
 
b/modules/core/src/test/java/org/apache/ignite/spi/communication/TestBadMessage.java
new file mode 100644
index 00000000000..195432e4577
--- /dev/null
+++ 
b/modules/core/src/test/java/org/apache/ignite/spi/communication/TestBadMessage.java
@@ -0,0 +1,62 @@
+/*
+ * 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.spi.communication;
+
+import java.util.UUID;
+import org.apache.ignite.internal.Order;
+import org.apache.ignite.internal.processors.cache.GridCacheMessage;
+import org.apache.ignite.plugin.extensions.communication.Message;
+
+/**
+ * Test message class.
+ */
+public class TestBadMessage extends GridCacheMessage {
+    /** */
+    public static final short DIRECT_TYPE = 204;
+
+    /** Node id. */
+    @Order(0)
+    UUID nodeId;
+
+    /** Integer field. */
+    @Order(1)
+    int id;
+
+    /** Body. */
+    @Order(2)
+    String body;
+
+    /** */
+    @Order(3)
+    Message msg;
+
+    /** {@inheritDoc} */
+    @Override public boolean addDeploymentInfo() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public short directType() {
+        return DIRECT_TYPE;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        throw new RuntimeException("Exception while log message");
+    }
+}
diff --git 
a/modules/core/src/test/java/org/apache/ignite/spi/communication/TestMessage.java
 
b/modules/core/src/test/java/org/apache/ignite/spi/communication/TestMessage.java
new file mode 100644
index 00000000000..d69e74a522f
--- /dev/null
+++ 
b/modules/core/src/test/java/org/apache/ignite/spi/communication/TestMessage.java
@@ -0,0 +1,53 @@
+/*
+ * 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.spi.communication;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import org.apache.ignite.internal.Order;
+import org.apache.ignite.internal.processors.cache.GridCacheMessage;
+
+/** */
+public class TestMessage extends GridCacheMessage {
+    /** */
+    public static final short DIRECT_TYPE = 202;
+
+    /** */
+    @Order(0)
+    Collection<TestMessage1> entries = new ArrayList<>();
+
+    /** @param entry Entry. */
+    public void add(TestMessage1 entry) {
+        entries.add(entry);
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean addDeploymentInfo() {
+        return false;
+    }
+
+    /** @return Collection of test messages. */
+    public Collection<TestMessage1> entries() {
+        return entries;
+    }
+
+    /** {@inheritDoc} */
+    @Override public short directType() {
+        return DIRECT_TYPE;
+    }
+}
diff --git 
a/modules/core/src/test/java/org/apache/ignite/spi/communication/TestMessage1.java
 
b/modules/core/src/test/java/org/apache/ignite/spi/communication/TestMessage1.java
new file mode 100644
index 00000000000..ea36359b45f
--- /dev/null
+++ 
b/modules/core/src/test/java/org/apache/ignite/spi/communication/TestMessage1.java
@@ -0,0 +1,67 @@
+/*
+ * 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.spi.communication;
+
+import org.apache.ignite.internal.Order;
+import org.apache.ignite.internal.processors.cache.GridCacheMessage;
+import org.apache.ignite.plugin.extensions.communication.Message;
+
+/**
+ * Test message class.
+ */
+public class TestMessage1 extends GridCacheMessage {
+    /** */
+    public static final short DIRECT_TYPE = 203;
+
+    /** Body. */
+    @Order(0)
+    String body;
+
+    /** */
+    @Order(1)
+    Message msg;
+
+    /**
+     * @param msg Message.
+     * @param body Message body.
+     */
+    public void init(Message msg, String body) {
+        this.msg = msg;
+        this.body = body;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean addDeploymentInfo() {
+        return false;
+    }
+
+    /** @return Body. */
+    public String body() {
+        return body;
+    }
+
+    /** @return Message. */
+    public Message message() {
+        return msg;
+    }
+
+    /** {@inheritDoc} */
+    @Override public short directType() {
+        return DIRECT_TYPE;
+    }
+}
diff --git 
a/modules/core/src/test/java/org/apache/ignite/spi/communication/TestMessage2.java
 
b/modules/core/src/test/java/org/apache/ignite/spi/communication/TestMessage2.java
new file mode 100644
index 00000000000..5b71d33c359
--- /dev/null
+++ 
b/modules/core/src/test/java/org/apache/ignite/spi/communication/TestMessage2.java
@@ -0,0 +1,85 @@
+/*
+ * 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.spi.communication;
+
+import java.util.UUID;
+import org.apache.ignite.internal.Order;
+import org.apache.ignite.internal.processors.cache.GridCacheMessage;
+import org.apache.ignite.plugin.extensions.communication.Message;
+
+/**
+ * Test message class.
+ */
+public class TestMessage2 extends GridCacheMessage {
+    /** */
+    public static final short DIRECT_TYPE = 201;
+
+    /** Node id. */
+    @Order(0)
+    UUID nodeId;
+
+    /** Integer field. */
+    @Order(1)
+    int id;
+
+    /** Body. */
+    @Order(2)
+    String body;
+
+    /** */
+    @Order(3)
+    Message msg;
+
+    /** @param mes Message. */
+    public void init(Message mes, UUID nodeId, int id, String body) {
+        this.nodeId = nodeId;
+        this.id = id;
+        this.msg = mes;
+        this.body = body;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean addDeploymentInfo() {
+        return false;
+    }
+
+    /** @return Body.*/
+    public String body() {
+        return body;
+    }
+
+    /** @return Message. */
+    public Message message() {
+        return msg;
+    }
+
+    /** @return Node id. */
+    public UUID nodeId() {
+        return nodeId;
+    }
+
+    /** @return Id. */
+    public int id() {
+        return id;
+    }
+
+    /** {@inheritDoc} */
+    @Override public short directType() {
+        return DIRECT_TYPE;
+    }
+}
diff --git 
a/modules/core/src/test/java/org/apache/ignite/spi/communication/TestVolatilePayloadMessage.java
 
b/modules/core/src/test/java/org/apache/ignite/spi/communication/TestVolatilePayloadMessage.java
index 16aa598c222..1a428be60e3 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/spi/communication/TestVolatilePayloadMessage.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/spi/communication/TestVolatilePayloadMessage.java
@@ -17,10 +17,8 @@
 
 package org.apache.ignite.spi.communication;
 
-import java.nio.ByteBuffer;
+import org.apache.ignite.internal.Order;
 import org.apache.ignite.plugin.extensions.communication.Message;
-import org.apache.ignite.plugin.extensions.communication.MessageReader;
-import org.apache.ignite.plugin.extensions.communication.MessageWriter;
 
 /** */
 public class TestVolatilePayloadMessage implements Message {
@@ -28,13 +26,16 @@ public class TestVolatilePayloadMessage implements Message {
     public static final short DIRECT_TYPE = 210;
 
     /** */
-    private int idx;
+    @Order(0)
+    int idx;
 
     /** */
-    private byte[] payload;
+    @Order(1)
+    byte[] payload;
 
     /** */
-    private int payloadLen;
+    @Order(2)
+    int payloadLen;
 
     /** */
     public TestVolatilePayloadMessage() {
@@ -53,81 +54,11 @@ public class TestVolatilePayloadMessage implements Message {
         return idx;
     }
 
-    /**
-     * @return Network payload.
-     */
+    /** @return Network payload. */
     public byte[] payload() {
         return payload;
     }
 
-    /** {@inheritDoc} */
-    @Override public boolean writeTo(ByteBuffer buf, MessageWriter writer) {
-        writer.setBuffer(buf);
-
-        if (!writer.isHeaderWritten()) {
-            if (!writer.writeHeader(directType()))
-                return false;
-
-            writer.onHeaderWritten();
-        }
-
-        switch (writer.state()) {
-            case 0:
-                if (!writer.writeInt(idx))
-                    return false;
-
-                writer.incrementState();
-            case 1:
-                if (!writer.writeInt(payloadLen))
-                    return false;
-
-                writer.incrementState();
-            case 2:
-                if (!writer.writeByteArray(payload))
-                    return false;
-
-                writer.incrementState();
-        }
-
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
-        reader.setBuffer(buf);
-
-        switch (reader.state()) {
-            case 0:
-                idx = reader.readInt();
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 1:
-                payloadLen = reader.readInt();
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-
-            case 2:
-                if (buf.remaining() < payloadLen)
-                    return false;
-
-                payload = reader.readByteArray();
-
-                if (!reader.isLastRead())
-                    return false;
-
-                reader.incrementState();
-        }
-
-        return true;
-    }
-
     /** {@inheritDoc} */
     @Override public short directType() {
         return DIRECT_TYPE;
diff --git 
a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/CommunicationConnectionPoolMetricsTest.java
 
b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/CommunicationConnectionPoolMetricsTest.java
index b369b2e6f1c..5d18e781e1e 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/CommunicationConnectionPoolMetricsTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/CommunicationConnectionPoolMetricsTest.java
@@ -46,8 +46,8 @@ import org.apache.ignite.plugin.PluginContext;
 import org.apache.ignite.plugin.extensions.communication.Message;
 import org.apache.ignite.plugin.extensions.communication.MessageFactory;
 import 
org.apache.ignite.plugin.extensions.communication.MessageFactoryProvider;
+import org.apache.ignite.plugin.extensions.communication.MessageReader;
 import org.apache.ignite.plugin.extensions.communication.MessageWriter;
-import org.apache.ignite.spi.communication.GridTestMessage;
 import org.apache.ignite.spi.communication.tcp.internal.ConnectionClientPool;
 import org.apache.ignite.spi.metric.IntMetric;
 import org.apache.ignite.spi.metric.LongMetric;
@@ -542,7 +542,10 @@ public class CommunicationConnectionPoolMetricsTest 
extends GridCommonAbstractTe
     }
 
     /** */
-    private static class TestMessage extends GridTestMessage {
+    private static class TestMessage implements Message {
+        /** */
+        public static final short DIRECT_TYPE = 200;
+
         /** */
         private final int writeDelay;
 
@@ -567,7 +570,22 @@ public class CommunicationConnectionPoolMetricsTest 
extends GridCommonAbstractTe
                 }
             }
 
-            return super.writeTo(buf, writer);
+            writer.setBuffer(buf);
+
+            if (!writer.writeHeader(directType()))
+                return false;
+
+            return true;
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean readFrom(ByteBuffer buf, MessageReader 
reader) {
+            return true;
+        }
+
+        /** {@inheritDoc} */
+        @Override public short directType() {
+            return DIRECT_TYPE;
         }
     }
 }
diff --git 
a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiAbstractTest.java
 
b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiAbstractTest.java
index d9fe1c6f811..d355ba404a1 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiAbstractTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiAbstractTest.java
@@ -19,7 +19,6 @@ package org.apache.ignite.spi.communication.tcp;
 
 import java.util.ArrayList;
 import java.util.BitSet;
-import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
@@ -29,7 +28,6 @@ import java.util.UUID;
 import java.util.concurrent.Callable;
 import java.util.concurrent.ConcurrentMap;
 import java.util.concurrent.CyclicBarrier;
-import java.util.function.Supplier;
 import org.apache.ignite.cluster.ClusterNode;
 import org.apache.ignite.internal.IgniteInternalFuture;
 import org.apache.ignite.internal.util.nio.GridCommunicationClient;
@@ -38,6 +36,7 @@ import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.lang.IgniteFuture;
 import org.apache.ignite.lang.IgniteRunnable;
 import org.apache.ignite.plugin.extensions.communication.Message;
+import 
org.apache.ignite.plugin.extensions.communication.MessageFactoryProvider;
 import org.apache.ignite.spi.IgniteSpiAdapter;
 import org.apache.ignite.spi.communication.CommunicationListener;
 import org.apache.ignite.spi.communication.CommunicationSpi;
@@ -46,6 +45,8 @@ import org.apache.ignite.spi.communication.GridTestMessage;
 import org.apache.ignite.testframework.GridTestUtils;
 import org.junit.Test;
 
+import static 
org.apache.ignite.spi.communication.GridTestMessage.GRID_TEST_MESSAGE_FACTORY;
+
 /**
  * Test for {@link TcpCommunicationSpi}
  */
@@ -86,8 +87,8 @@ abstract class GridTcpCommunicationSpiAbstractTest extends 
GridAbstractCommunica
     }
 
     /** {@inheritDoc} */
-    @Override protected Map<Short, Supplier<Message>> customMessageTypes() {
-        return Collections.singletonMap(GridTestMessage.DIRECT_TYPE, 
GridTestMessage::new);
+    @Override protected MessageFactoryProvider customMessageFactory() {
+        return GRID_TEST_MESSAGE_FACTORY;
     }
 
     /** */
diff --git 
a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiConcurrentConnectSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiConcurrentConnectSelfTest.java
index 54c6a40c1fa..654e7289280 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiConcurrentConnectSelfTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiConcurrentConnectSelfTest.java
@@ -47,7 +47,6 @@ import org.apache.ignite.internal.util.nio.GridNioServer;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.lang.IgniteRunnable;
 import org.apache.ignite.plugin.extensions.communication.Message;
-import org.apache.ignite.plugin.extensions.communication.MessageFactory;
 import 
org.apache.ignite.plugin.extensions.communication.MessageFactoryProvider;
 import org.apache.ignite.spi.IgniteSpiAdapter;
 import org.apache.ignite.spi.communication.CommunicationListener;
@@ -65,6 +64,7 @@ import org.apache.ignite.testframework.junits.spi.GridSpiTest;
 import org.junit.Test;
 
 import static org.apache.ignite.marshaller.Marshallers.jdk;
+import static 
org.apache.ignite.spi.communication.GridTestMessage.GRID_TEST_MESSAGE_FACTORY;
 
 /**
  *
@@ -433,14 +433,8 @@ public class 
GridTcpCommunicationSpiConcurrentConnectSelfTest<T extends Communic
 
             GridSpiTestContext ctx = initSpiContext();
 
-            MessageFactoryProvider testMsgFactory = new 
MessageFactoryProvider() {
-                @Override public void registerAll(MessageFactory factory) {
-                    factory.register(GridTestMessage.DIRECT_TYPE, 
GridTestMessage::new);
-                }
-            };
-
             ctx.messageFactory(new IgniteMessageFactoryImpl(
-                    new MessageFactoryProvider[] {new 
GridIoMessageFactory(jdk(), U.gridClassLoader()), testMsgFactory})
+                new MessageFactoryProvider[] {new GridIoMessageFactory(jdk(), 
U.gridClassLoader()), GRID_TEST_MESSAGE_FACTORY})
             );
 
             ctx.setLocalNode(node);
diff --git 
a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiConfigSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiConfigSelfTest.java
index 11a00c77265..d4f53758320 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiConfigSelfTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiConfigSelfTest.java
@@ -59,6 +59,7 @@ import static 
org.apache.ignite.IgniteSystemProperties.getBoolean;
 import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_MACS;
 import static org.apache.ignite.internal.util.IgniteUtils.spiAttribute;
 import static org.apache.ignite.marshaller.Marshallers.jdk;
+import static 
org.apache.ignite.spi.communication.GridTestMessage.GRID_TEST_MESSAGE_FACTORY;
 import static 
org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi.ATTR_HOST_NAMES;
 import static org.apache.ignite.testframework.GridTestUtils.getFreeCommPort;
 
@@ -250,10 +251,8 @@ public class GridTcpCommunicationSpiConfigSelfTest extends 
GridSpiAbstractConfig
 
         node.setId(rsrcs.getNodeId());
 
-        MessageFactoryProvider testMsgFactory = factory -> 
factory.register(GridTestMessage.DIRECT_TYPE, GridTestMessage::new);
-
         ctx.messageFactory(new IgniteMessageFactoryImpl(new 
MessageFactoryProvider[]{
-            new GridIoMessageFactory(jdk(), U.gridClassLoader()), 
testMsgFactory}));
+            new GridIoMessageFactory(jdk(), U.gridClassLoader()), 
GRID_TEST_MESSAGE_FACTORY}));
 
         ctx.setLocalNode(node);
 
diff --git 
a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiMultithreadedSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiMultithreadedSelfTest.java
index 2d08829de43..18909f7add4 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiMultithreadedSelfTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiMultithreadedSelfTest.java
@@ -65,6 +65,7 @@ import org.junit.Test;
 
 import static org.apache.ignite.internal.IgniteNodeAttributes.ATTR_MACS;
 import static org.apache.ignite.marshaller.Marshallers.jdk;
+import static 
org.apache.ignite.spi.communication.GridTestMessage.GRID_TEST_MESSAGE_FACTORY;
 
 /**
  * Class for multithreaded {@link TcpCommunicationSpi} test.
@@ -466,10 +467,8 @@ public class GridTcpCommunicationSpiMultithreadedSelfTest 
extends GridSpiAbstrac
 
             GridSpiTestContext ctx = initSpiContext();
 
-            MessageFactoryProvider testMsgFactory = factory -> 
factory.register(GridTestMessage.DIRECT_TYPE, GridTestMessage::new);
-
             ctx.messageFactory(new IgniteMessageFactoryImpl(
-                    new MessageFactoryProvider[] {new 
GridIoMessageFactory(jdk(), U.gridClassLoader()), testMsgFactory})
+                    new MessageFactoryProvider[] {new 
GridIoMessageFactory(jdk(), U.gridClassLoader()), GRID_TEST_MESSAGE_FACTORY})
             );
 
             ctx.timeoutProcessor(timeoutProcessor);
diff --git 
a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoveryAckSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoveryAckSelfTest.java
index d9673085e92..91343407e1a 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoveryAckSelfTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoveryAckSelfTest.java
@@ -38,7 +38,6 @@ import org.apache.ignite.internal.util.nio.GridNioSession;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.lang.IgniteRunnable;
 import org.apache.ignite.plugin.extensions.communication.Message;
-import org.apache.ignite.plugin.extensions.communication.MessageFactory;
 import 
org.apache.ignite.plugin.extensions.communication.MessageFactoryProvider;
 import org.apache.ignite.spi.IgniteSpiAdapter;
 import org.apache.ignite.spi.IgniteSpiException;
@@ -56,6 +55,7 @@ import org.apache.ignite.testframework.junits.spi.GridSpiTest;
 import org.junit.Test;
 
 import static org.apache.ignite.marshaller.Marshallers.jdk;
+import static 
org.apache.ignite.spi.communication.GridTestMessage.GRID_TEST_MESSAGE_FACTORY;
 
 /**
  *
@@ -399,14 +399,8 @@ public class GridTcpCommunicationSpiRecoveryAckSelfTest<T 
extends CommunicationS
 
             GridSpiTestContext ctx = initSpiContext();
 
-            MessageFactoryProvider testMsgFactory = new 
MessageFactoryProvider() {
-                @Override public void registerAll(MessageFactory factory) {
-                    factory.register(GridTestMessage.DIRECT_TYPE, 
GridTestMessage::new);
-                }
-            };
-
             ctx.messageFactory(new IgniteMessageFactoryImpl(
-                    new MessageFactoryProvider[] {new 
GridIoMessageFactory(jdk(), U.gridClassLoader()), testMsgFactory})
+                    new MessageFactoryProvider[] {new 
GridIoMessageFactory(jdk(), U.gridClassLoader()), GRID_TEST_MESSAGE_FACTORY})
             );
 
             ctx.setLocalNode(node);
diff --git 
a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoverySelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoverySelfTest.java
index 2169a66915f..46bac32c8ff 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoverySelfTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiRecoverySelfTest.java
@@ -60,6 +60,7 @@ import org.apache.ignite.testframework.junits.spi.GridSpiTest;
 import org.junit.Test;
 
 import static org.apache.ignite.marshaller.Marshallers.jdk;
+import static 
org.apache.ignite.spi.communication.GridTestMessage.GRID_TEST_MESSAGE_FACTORY;
 
 /**
  *
@@ -727,10 +728,8 @@ public class GridTcpCommunicationSpiRecoverySelfTest<T 
extends CommunicationSpi<
 
             GridSpiTestContext ctx = initSpiContext();
 
-            MessageFactoryProvider testMsgFactory = factory -> 
factory.register(GridTestMessage.DIRECT_TYPE, GridTestMessage::new);
-
             ctx.messageFactory(new IgniteMessageFactoryImpl(
-                    new MessageFactoryProvider[] {new 
GridIoMessageFactory(jdk(), U.gridClassLoader()), testMsgFactory})
+                new MessageFactoryProvider[] {new GridIoMessageFactory(jdk(), 
U.gridClassLoader()), GRID_TEST_MESSAGE_FACTORY})
             );
 
             ctx.setLocalNode(node);
diff --git 
a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/IgniteTcpCommunicationRecoveryAckClosureSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/IgniteTcpCommunicationRecoveryAckClosureSelfTest.java
index de813ed505d..a1eff7105d7 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/IgniteTcpCommunicationRecoveryAckClosureSelfTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/IgniteTcpCommunicationRecoveryAckClosureSelfTest.java
@@ -41,7 +41,6 @@ import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.lang.IgniteInClosure;
 import org.apache.ignite.lang.IgniteRunnable;
 import org.apache.ignite.plugin.extensions.communication.Message;
-import org.apache.ignite.plugin.extensions.communication.MessageFactory;
 import 
org.apache.ignite.plugin.extensions.communication.MessageFactoryProvider;
 import org.apache.ignite.spi.IgniteSpiAdapter;
 import org.apache.ignite.spi.IgniteSpiException;
@@ -59,6 +58,7 @@ import org.apache.ignite.testframework.junits.spi.GridSpiTest;
 import org.junit.Test;
 
 import static org.apache.ignite.marshaller.Marshallers.jdk;
+import static 
org.apache.ignite.spi.communication.GridTestMessage.GRID_TEST_MESSAGE_FACTORY;
 
 /**
  *
@@ -452,14 +452,8 @@ public class 
IgniteTcpCommunicationRecoveryAckClosureSelfTest<T extends Communic
 
             GridSpiTestContext ctx = initSpiContext();
 
-            MessageFactoryProvider testMsgFactory = new 
MessageFactoryProvider() {
-                @Override public void registerAll(MessageFactory factory) {
-                    factory.register(GridTestMessage.DIRECT_TYPE, 
GridTestMessage::new);
-                }
-            };
-
             ctx.messageFactory(new IgniteMessageFactoryImpl(
-                    new MessageFactoryProvider[] {new 
GridIoMessageFactory(jdk(), U.gridClassLoader()), testMsgFactory})
+                new MessageFactoryProvider[] {new GridIoMessageFactory(jdk(), 
U.gridClassLoader()), GRID_TEST_MESSAGE_FACTORY})
             );
 
             ctx.setLocalNode(node);
diff --git 
a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationStatisticsTest.java
 
b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationStatisticsTest.java
index f4d852f6557..3fccdb1be0f 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationStatisticsTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationStatisticsTest.java
@@ -38,13 +38,13 @@ import org.apache.ignite.plugin.AbstractTestPluginProvider;
 import org.apache.ignite.plugin.ExtensionRegistry;
 import org.apache.ignite.plugin.PluginContext;
 import org.apache.ignite.plugin.extensions.communication.Message;
-import org.apache.ignite.plugin.extensions.communication.MessageFactory;
 import 
org.apache.ignite.plugin.extensions.communication.MessageFactoryProvider;
 import org.apache.ignite.spi.IgniteSpiException;
 import org.apache.ignite.spi.communication.GridTestMessage;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 import org.junit.Test;
 
+import static 
org.apache.ignite.spi.communication.GridTestMessage.GRID_TEST_MESSAGE_FACTORY;
 import static 
org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi.COMMUNICATION_METRICS_GROUP_NAME;
 import static 
org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi.RECEIVED_MESSAGES_BY_NODE_CONSISTENT_ID_METRIC_NAME;
 import static 
org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi.SENT_MESSAGES_BY_NODE_CONSISTENT_ID_METRIC_NAME;
@@ -222,11 +222,7 @@ public class TcpCommunicationStatisticsTest extends 
GridCommonAbstractTest {
 
         /** {@inheritDoc} */
         @Override public void initExtensions(PluginContext ctx, 
ExtensionRegistry registry) {
-            registry.registerExtension(MessageFactoryProvider.class, new 
MessageFactoryProvider() {
-                @Override public void registerAll(MessageFactory factory) {
-                    factory.register(GridTestMessage.DIRECT_TYPE, 
GridTestMessage::new);
-                }
-            });
+            registry.registerExtension(MessageFactoryProvider.class, 
GRID_TEST_MESSAGE_FACTORY);
         }
     }
 }

Reply via email to