ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yzhda...@apache.org
Subject [20/50] [abbrv] incubator-ignite git commit: gg-9791 - Communication fixes
Date Wed, 25 Feb 2015 18:03:11 GMT
gg-9791 - Communication fixes


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

Branch: refs/heads/ignite-299
Commit: ad02d6e3825702514d430e42dd31a90a182814b2
Parents: 9c1e555
Author: Valentin Kulichenko <vkulichenko@gridgain.com>
Authored: Fri Feb 20 14:52:44 2015 -0800
Committer: Valentin Kulichenko <vkulichenko@gridgain.com>
Committed: Fri Feb 20 14:52:45 2015 -0800

----------------------------------------------------------------------
 .../ignite/codegen/MessageCodeGenerator.java    |  70 ++++++------
 .../ignite/internal/GridJobCancelRequest.java   |  10 +-
 .../ignite/internal/GridJobExecuteRequest.java  |  54 ++++-----
 .../ignite/internal/GridJobExecuteResponse.java |  18 +--
 .../ignite/internal/GridJobSiblingsRequest.java |   8 +-
 .../internal/GridJobSiblingsResponse.java       |   6 +-
 .../ignite/internal/GridTaskCancelRequest.java  |   6 +-
 .../ignite/internal/GridTaskSessionRequest.java |  10 +-
 .../internal/direct/DirectByteBufferStream.java |  23 ++--
 .../internal/direct/DirectMessageReader.java    |  21 +++-
 .../internal/direct/DirectMessageWriter.java    |   8 +-
 .../checkpoint/GridCheckpointRequest.java       |  10 +-
 .../managers/communication/GridIoMessage.java   |  18 +--
 .../communication/GridIoUserMessage.java        |  22 ++--
 .../deployment/GridDeploymentInfoBean.java      |  18 +--
 .../deployment/GridDeploymentRequest.java       |  18 +--
 .../deployment/GridDeploymentResponse.java      |  10 +-
 .../eventstorage/GridEventStorageMessage.java   |  26 ++---
 .../cache/GridCacheEvictionRequest.java         |  12 +-
 .../cache/GridCacheEvictionResponse.java        |  16 +--
 .../processors/cache/GridCacheMessage.java      |  10 +-
 .../processors/cache/GridCacheValueBytes.java   |   8 +-
 ...idCacheOptimisticCheckPreparedTxRequest.java |  16 +--
 ...dCacheOptimisticCheckPreparedTxResponse.java |  12 +-
 .../distributed/GridCacheTtlUpdateRequest.java  |  34 +++---
 .../distributed/GridDistributedBaseMessage.java |  24 ++--
 .../distributed/GridDistributedLockRequest.java |  38 +++----
 .../GridDistributedLockResponse.java            |  16 +--
 .../GridDistributedTxFinishRequest.java         |  28 ++---
 .../GridDistributedTxFinishResponse.java        |  10 +-
 .../GridDistributedTxPrepareRequest.java        |  44 ++++----
 .../GridDistributedTxPrepareResponse.java       |  10 +-
 .../GridDistributedUnlockRequest.java           |  12 +-
 .../dht/GridDhtAffinityAssignmentRequest.java   |   8 +-
 .../dht/GridDhtAffinityAssignmentResponse.java  |  10 +-
 .../distributed/dht/GridDhtLockRequest.java     |  28 ++---
 .../distributed/dht/GridDhtLockResponse.java    |  26 ++---
 .../distributed/dht/GridDhtTxFinishRequest.java |  28 ++---
 .../dht/GridDhtTxFinishResponse.java            |   8 +-
 .../dht/GridDhtTxPrepareRequest.java            |  34 +++---
 .../dht/GridDhtTxPrepareResponse.java           |  28 ++---
 .../distributed/dht/GridDhtUnlockRequest.java   |  12 +-
 .../GridDhtAtomicDeferredUpdateResponse.java    |  12 +-
 .../dht/atomic/GridDhtAtomicUpdateRequest.java  |  78 ++++++-------
 .../dht/atomic/GridDhtAtomicUpdateResponse.java |  18 +--
 .../dht/atomic/GridNearAtomicUpdateRequest.java |  64 +++++------
 .../atomic/GridNearAtomicUpdateResponse.java    |  40 +++----
 .../dht/preloader/GridDhtForceKeysRequest.java  |  18 +--
 .../dht/preloader/GridDhtForceKeysResponse.java |  18 +--
 .../GridDhtPartitionDemandMessage.java          |  22 ++--
 .../preloader/GridDhtPartitionExchangeId.java   |  10 +-
 .../GridDhtPartitionSupplyMessage.java          |  26 ++---
 .../GridDhtPartitionsAbstractMessage.java       |  10 +-
 .../preloader/GridDhtPartitionsFullMessage.java |  10 +-
 .../GridDhtPartitionsSingleMessage.java         |   8 +-
 .../GridDhtPartitionsSingleRequest.java         |   4 +-
 .../distributed/near/GridNearGetRequest.java    |  32 +++---
 .../distributed/near/GridNearGetResponse.java   |  24 ++--
 .../distributed/near/GridNearLockRequest.java   |  38 +++----
 .../distributed/near/GridNearLockResponse.java  |  28 ++---
 .../near/GridNearTxFinishRequest.java           |  18 +--
 .../near/GridNearTxFinishResponse.java          |  12 +-
 .../near/GridNearTxPrepareRequest.java          |  30 ++---
 .../near/GridNearTxPrepareResponse.java         |  34 +++---
 .../distributed/near/GridNearUnlockRequest.java |   4 +-
 .../cache/query/GridCacheQueryRequest.java      |  44 ++++----
 .../cache/query/GridCacheQueryResponse.java     |  26 ++---
 .../cache/version/GridCacheVersion.java         |  12 +-
 .../clock/GridClockDeltaSnapshotMessage.java    |  12 +-
 .../processors/clock/GridClockDeltaVersion.java |   8 +-
 .../continuous/GridContinuousMessage.java       |  12 +-
 .../dataload/GridDataLoadRequest.java           |  34 +++---
 .../dataload/GridDataLoadResponse.java          |  10 +-
 .../processors/igfs/IgfsAckMessage.java         |  12 +-
 .../internal/processors/igfs/IgfsBlockKey.java  |  12 +-
 .../processors/igfs/IgfsBlocksMessage.java      |  16 +--
 .../igfs/IgfsCommunicationMessage.java          |   2 +-
 .../processors/igfs/IgfsDeleteMessage.java      |  10 +-
 .../processors/igfs/IgfsFileAffinityRange.java  |  14 +--
 .../igfs/IgfsFragmentizerRequest.java           |  14 +--
 .../igfs/IgfsFragmentizerResponse.java          |   8 +-
 .../processors/igfs/IgfsSyncMessage.java        |  10 +-
 .../handlers/task/GridTaskResultRequest.java    |   8 +-
 .../handlers/task/GridTaskResultResponse.java   |  12 +-
 .../streamer/GridStreamerCancelRequest.java     |   6 +-
 .../streamer/GridStreamerExecutionRequest.java  |  22 ++--
 .../streamer/GridStreamerResponse.java          |   8 +-
 .../ignite/internal/util/GridByteArrayList.java |   8 +-
 .../ignite/internal/util/GridLongList.java      |   8 +-
 .../internal/util/nio/GridDirectParser.java     |  17 ++-
 .../ignite/internal/util/nio/GridNioServer.java |  43 +++++--
 .../communication/MessageAdapter.java           | 111 +------------------
 .../MessageCollectionItemType.java              | 101 +++++++++++++++++
 .../extensions/communication/MessageReader.java |  20 +++-
 .../extensions/communication/MessageWriter.java |   8 +-
 .../jobstealing/JobStealingRequest.java         |   6 +-
 .../communication/tcp/TcpCommunicationSpi.java  |  24 ++--
 .../GridCommunicationSendMessageSelfTest.java   |   2 +-
 .../communication/GridIoManagerSelfTest.java    |   2 +-
 .../communication/GridTestMessage.java          |   2 +-
 .../spi/communication/GridTestMessage.java      |  12 +-
 101 files changed, 1063 insertions(+), 999 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ad02d6e3/modules/codegen/src/main/java/org/apache/ignite/codegen/MessageCodeGenerator.java
----------------------------------------------------------------------
diff --git a/modules/codegen/src/main/java/org/apache/ignite/codegen/MessageCodeGenerator.java b/modules/codegen/src/main/java/org/apache/ignite/codegen/MessageCodeGenerator.java
index 666ee38..d442762 100644
--- a/modules/codegen/src/main/java/org/apache/ignite/codegen/MessageCodeGenerator.java
+++ b/modules/codegen/src/main/java/org/apache/ignite/codegen/MessageCodeGenerator.java
@@ -57,50 +57,50 @@ public class MessageCodeGenerator {
     private static final String BUF_VAR = "buf";
 
     /** */
-    private static final Map<Class<?>, MessageAdapter.Type> TYPES = U.newHashMap(30);
+    private static final Map<Class<?>, MessageCollectionItemType> TYPES = U.newHashMap(30);
 
     static {
-        TYPES.put(byte.class, MessageAdapter.Type.BYTE);
-        TYPES.put(Byte.class, MessageAdapter.Type.BYTE);
-        TYPES.put(short.class, MessageAdapter.Type.SHORT);
-        TYPES.put(Short.class, MessageAdapter.Type.SHORT);
-        TYPES.put(int.class, MessageAdapter.Type.INT);
-        TYPES.put(Integer.class, MessageAdapter.Type.INT);
-        TYPES.put(long.class, MessageAdapter.Type.LONG);
-        TYPES.put(Long.class, MessageAdapter.Type.LONG);
-        TYPES.put(float.class, MessageAdapter.Type.FLOAT);
-        TYPES.put(Float.class, MessageAdapter.Type.FLOAT);
-        TYPES.put(double.class, MessageAdapter.Type.DOUBLE);
-        TYPES.put(Double.class, MessageAdapter.Type.DOUBLE);
-        TYPES.put(char.class, MessageAdapter.Type.CHAR);
-        TYPES.put(Character.class, MessageAdapter.Type.CHAR);
-        TYPES.put(boolean.class, MessageAdapter.Type.BOOLEAN);
-        TYPES.put(Boolean.class, MessageAdapter.Type.BOOLEAN);
-        TYPES.put(byte[].class, MessageAdapter.Type.BYTE_ARR);
-        TYPES.put(short[].class, MessageAdapter.Type.SHORT_ARR);
-        TYPES.put(int[].class, MessageAdapter.Type.INT_ARR);
-        TYPES.put(long[].class, MessageAdapter.Type.LONG_ARR);
-        TYPES.put(float[].class, MessageAdapter.Type.FLOAT_ARR);
-        TYPES.put(double[].class, MessageAdapter.Type.DOUBLE_ARR);
-        TYPES.put(char[].class, MessageAdapter.Type.CHAR_ARR);
-        TYPES.put(boolean[].class, MessageAdapter.Type.BOOLEAN_ARR);
-        TYPES.put(String.class, MessageAdapter.Type.STRING);
-        TYPES.put(BitSet.class, MessageAdapter.Type.BIT_SET);
-        TYPES.put(UUID.class, MessageAdapter.Type.UUID);
-        TYPES.put(IgniteUuid.class, MessageAdapter.Type.IGNITE_UUID);
+        TYPES.put(byte.class, MessageCollectionItemType.BYTE);
+        TYPES.put(Byte.class, MessageCollectionItemType.BYTE);
+        TYPES.put(short.class, MessageCollectionItemType.SHORT);
+        TYPES.put(Short.class, MessageCollectionItemType.SHORT);
+        TYPES.put(int.class, MessageCollectionItemType.INT);
+        TYPES.put(Integer.class, MessageCollectionItemType.INT);
+        TYPES.put(long.class, MessageCollectionItemType.LONG);
+        TYPES.put(Long.class, MessageCollectionItemType.LONG);
+        TYPES.put(float.class, MessageCollectionItemType.FLOAT);
+        TYPES.put(Float.class, MessageCollectionItemType.FLOAT);
+        TYPES.put(double.class, MessageCollectionItemType.DOUBLE);
+        TYPES.put(Double.class, MessageCollectionItemType.DOUBLE);
+        TYPES.put(char.class, MessageCollectionItemType.CHAR);
+        TYPES.put(Character.class, MessageCollectionItemType.CHAR);
+        TYPES.put(boolean.class, MessageCollectionItemType.BOOLEAN);
+        TYPES.put(Boolean.class, MessageCollectionItemType.BOOLEAN);
+        TYPES.put(byte[].class, MessageCollectionItemType.BYTE_ARR);
+        TYPES.put(short[].class, MessageCollectionItemType.SHORT_ARR);
+        TYPES.put(int[].class, MessageCollectionItemType.INT_ARR);
+        TYPES.put(long[].class, MessageCollectionItemType.LONG_ARR);
+        TYPES.put(float[].class, MessageCollectionItemType.FLOAT_ARR);
+        TYPES.put(double[].class, MessageCollectionItemType.DOUBLE_ARR);
+        TYPES.put(char[].class, MessageCollectionItemType.CHAR_ARR);
+        TYPES.put(boolean[].class, MessageCollectionItemType.BOOLEAN_ARR);
+        TYPES.put(String.class, MessageCollectionItemType.STRING);
+        TYPES.put(BitSet.class, MessageCollectionItemType.BIT_SET);
+        TYPES.put(UUID.class, MessageCollectionItemType.UUID);
+        TYPES.put(IgniteUuid.class, MessageCollectionItemType.IGNITE_UUID);
     }
 
     /**
      * @param cls Class.
      * @return Type enum value.
      */
-    private static MessageAdapter.Type typeEnum(Class<?> cls) {
-        MessageAdapter.Type type = TYPES.get(cls);
+    private static MessageCollectionItemType typeEnum(Class<?> cls) {
+        MessageCollectionItemType type = TYPES.get(cls);
 
         if (type == null) {
             assert MessageAdapter.class.isAssignableFrom(cls) : cls;
 
-            type = MessageAdapter.Type.MSG;
+            type = MessageCollectionItemType.MSG;
         }
 
         return type;
@@ -241,7 +241,7 @@ public class MessageCodeGenerator {
 
                         writeFound = true;
                     }
-                    else if (line.contains("public boolean readFrom(ByteBuffer buf)")) {
+                    else if (line.contains("public boolean readFrom(ByteBuffer buf, MessageReader reader)")) {
                         src.addAll(read);
 
                         skip = true;
@@ -418,7 +418,7 @@ public class MessageCodeGenerator {
         }
 
         if (!fields.isEmpty())
-            code.add(builder().a("switch (").a(write ? "writer.state()" : "readState").a(") {").toString());
+            code.add(builder().a("switch (").a(write ? "writer.state()" : "reader.state()").a(") {").toString());
     }
 
     /**
@@ -501,7 +501,7 @@ public class MessageCodeGenerator {
             mapAnn != null ? mapAnn.keyType() : null, mapAnn != null ? mapAnn.valueType() : null);
 
         read.add(EMPTY);
-        read.add(builder().a("readState++;").toString());
+        read.add(builder().a("reader.incrementState();").toString());
         read.add(EMPTY);
 
         indent--;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ad02d6e3/modules/core/src/main/java/org/apache/ignite/internal/GridJobCancelRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridJobCancelRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/GridJobCancelRequest.java
index c9df6a7..2dc704b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridJobCancelRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridJobCancelRequest.java
@@ -145,20 +145,20 @@ public class GridJobCancelRequest extends MessageAdapter {
     }
 
     /** {@inheritDoc} */
-    @Override public boolean readFrom(ByteBuffer buf) {
+    @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
         reader.setBuffer(buf);
 
         if (!reader.beforeMessageRead())
             return false;
 
-        switch (readState) {
+        switch (reader.state()) {
             case 0:
                 jobId = reader.readIgniteUuid("jobId");
 
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 1:
                 sesId = reader.readIgniteUuid("sesId");
@@ -166,7 +166,7 @@ public class GridJobCancelRequest extends MessageAdapter {
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 2:
                 sys = reader.readBoolean("sys");
@@ -174,7 +174,7 @@ public class GridJobCancelRequest extends MessageAdapter {
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ad02d6e3/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteRequest.java
index 5b81190..ae1fe12 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteRequest.java
@@ -478,7 +478,7 @@ public class GridJobExecuteRequest extends MessageAdapter implements GridTaskMes
                 writer.incrementState();
 
             case 9:
-                if (!writer.writeMap("ldrParticipants", ldrParticipants, Type.UUID, Type.IGNITE_UUID))
+                if (!writer.writeMap("ldrParticipants", ldrParticipants, MessageCollectionItemType.UUID, MessageCollectionItemType.IGNITE_UUID))
                     return false;
 
                 writer.incrementState();
@@ -538,7 +538,7 @@ public class GridJobExecuteRequest extends MessageAdapter implements GridTaskMes
                 writer.incrementState();
 
             case 19:
-                if (!writer.writeCollection("top", top, Type.UUID))
+                if (!writer.writeCollection("top", top, MessageCollectionItemType.UUID))
                     return false;
 
                 writer.incrementState();
@@ -555,20 +555,20 @@ public class GridJobExecuteRequest extends MessageAdapter implements GridTaskMes
     }
 
     /** {@inheritDoc} */
-    @Override public boolean readFrom(ByteBuffer buf) {
+    @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
         reader.setBuffer(buf);
 
         if (!reader.beforeMessageRead())
             return false;
 
-        switch (readState) {
+        switch (reader.state()) {
             case 0:
                 clsLdrId = reader.readIgniteUuid("clsLdrId");
 
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 1:
                 cpSpi = reader.readString("cpSpi");
@@ -576,7 +576,7 @@ public class GridJobExecuteRequest extends MessageAdapter implements GridTaskMes
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 2:
                 byte depModeOrd;
@@ -588,7 +588,7 @@ public class GridJobExecuteRequest extends MessageAdapter implements GridTaskMes
 
                 depMode = DeploymentMode.fromOrdinal(depModeOrd);
 
-                readState++;
+                reader.incrementState();
 
             case 3:
                 dynamicSiblings = reader.readBoolean("dynamicSiblings");
@@ -596,7 +596,7 @@ public class GridJobExecuteRequest extends MessageAdapter implements GridTaskMes
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 4:
                 forceLocDep = reader.readBoolean("forceLocDep");
@@ -604,7 +604,7 @@ public class GridJobExecuteRequest extends MessageAdapter implements GridTaskMes
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 5:
                 internal = reader.readBoolean("internal");
@@ -612,7 +612,7 @@ public class GridJobExecuteRequest extends MessageAdapter implements GridTaskMes
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 6:
                 jobAttrsBytes = reader.readByteArray("jobAttrsBytes");
@@ -620,7 +620,7 @@ public class GridJobExecuteRequest extends MessageAdapter implements GridTaskMes
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 7:
                 jobBytes = reader.readByteArray("jobBytes");
@@ -628,7 +628,7 @@ public class GridJobExecuteRequest extends MessageAdapter implements GridTaskMes
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 8:
                 jobId = reader.readIgniteUuid("jobId");
@@ -636,15 +636,15 @@ public class GridJobExecuteRequest extends MessageAdapter implements GridTaskMes
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 9:
-                ldrParticipants = reader.readMap("ldrParticipants", Type.UUID, Type.IGNITE_UUID, false);
+                ldrParticipants = reader.readMap("ldrParticipants", MessageCollectionItemType.UUID, MessageCollectionItemType.IGNITE_UUID, false);
 
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 10:
                 sesAttrsBytes = reader.readByteArray("sesAttrsBytes");
@@ -652,7 +652,7 @@ public class GridJobExecuteRequest extends MessageAdapter implements GridTaskMes
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 11:
                 sesFullSup = reader.readBoolean("sesFullSup");
@@ -660,7 +660,7 @@ public class GridJobExecuteRequest extends MessageAdapter implements GridTaskMes
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 12:
                 sesId = reader.readIgniteUuid("sesId");
@@ -668,7 +668,7 @@ public class GridJobExecuteRequest extends MessageAdapter implements GridTaskMes
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 13:
                 siblingsBytes = reader.readByteArray("siblingsBytes");
@@ -676,7 +676,7 @@ public class GridJobExecuteRequest extends MessageAdapter implements GridTaskMes
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 14:
                 startTaskTime = reader.readLong("startTaskTime");
@@ -684,7 +684,7 @@ public class GridJobExecuteRequest extends MessageAdapter implements GridTaskMes
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 15:
                 subjId = reader.readUuid("subjId");
@@ -692,7 +692,7 @@ public class GridJobExecuteRequest extends MessageAdapter implements GridTaskMes
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 16:
                 taskClsName = reader.readString("taskClsName");
@@ -700,7 +700,7 @@ public class GridJobExecuteRequest extends MessageAdapter implements GridTaskMes
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 17:
                 taskName = reader.readString("taskName");
@@ -708,7 +708,7 @@ public class GridJobExecuteRequest extends MessageAdapter implements GridTaskMes
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 18:
                 timeout = reader.readLong("timeout");
@@ -716,15 +716,15 @@ public class GridJobExecuteRequest extends MessageAdapter implements GridTaskMes
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 19:
-                top = reader.readCollection("top", Type.UUID);
+                top = reader.readCollection("top", MessageCollectionItemType.UUID);
 
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 20:
                 userVer = reader.readString("userVer");
@@ -732,7 +732,7 @@ public class GridJobExecuteRequest extends MessageAdapter implements GridTaskMes
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ad02d6e3/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteResponse.java
index 2eaa40f..6bc2749 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridJobExecuteResponse.java
@@ -264,20 +264,20 @@ public class GridJobExecuteResponse extends MessageAdapter implements GridTaskMe
     }
 
     /** {@inheritDoc} */
-    @Override public boolean readFrom(ByteBuffer buf) {
+    @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
         reader.setBuffer(buf);
 
         if (!reader.beforeMessageRead())
             return false;
 
-        switch (readState) {
+        switch (reader.state()) {
             case 0:
                 gridExBytes = reader.readByteArray("gridExBytes");
 
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 1:
                 isCancelled = reader.readBoolean("isCancelled");
@@ -285,7 +285,7 @@ public class GridJobExecuteResponse extends MessageAdapter implements GridTaskMe
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 2:
                 jobAttrsBytes = reader.readByteArray("jobAttrsBytes");
@@ -293,7 +293,7 @@ public class GridJobExecuteResponse extends MessageAdapter implements GridTaskMe
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 3:
                 jobId = reader.readIgniteUuid("jobId");
@@ -301,7 +301,7 @@ public class GridJobExecuteResponse extends MessageAdapter implements GridTaskMe
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 4:
                 nodeId = reader.readUuid("nodeId");
@@ -309,7 +309,7 @@ public class GridJobExecuteResponse extends MessageAdapter implements GridTaskMe
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 5:
                 resBytes = reader.readByteArray("resBytes");
@@ -317,7 +317,7 @@ public class GridJobExecuteResponse extends MessageAdapter implements GridTaskMe
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 6:
                 sesId = reader.readIgniteUuid("sesId");
@@ -325,7 +325,7 @@ public class GridJobExecuteResponse extends MessageAdapter implements GridTaskMe
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ad02d6e3/modules/core/src/main/java/org/apache/ignite/internal/GridJobSiblingsRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridJobSiblingsRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/GridJobSiblingsRequest.java
index 553896b..220b741 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridJobSiblingsRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridJobSiblingsRequest.java
@@ -113,20 +113,20 @@ public class GridJobSiblingsRequest extends MessageAdapter {
     }
 
     /** {@inheritDoc} */
-    @Override public boolean readFrom(ByteBuffer buf) {
+    @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
         reader.setBuffer(buf);
 
         if (!reader.beforeMessageRead())
             return false;
 
-        switch (readState) {
+        switch (reader.state()) {
             case 0:
                 sesId = reader.readIgniteUuid("sesId");
 
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 1:
                 topicBytes = reader.readByteArray("topicBytes");
@@ -134,7 +134,7 @@ public class GridJobSiblingsRequest extends MessageAdapter {
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ad02d6e3/modules/core/src/main/java/org/apache/ignite/internal/GridJobSiblingsResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridJobSiblingsResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/GridJobSiblingsResponse.java
index 75375cd..533c231 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridJobSiblingsResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridJobSiblingsResponse.java
@@ -100,20 +100,20 @@ public class GridJobSiblingsResponse extends MessageAdapter {
     }
 
     /** {@inheritDoc} */
-    @Override public boolean readFrom(ByteBuffer buf) {
+    @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
         reader.setBuffer(buf);
 
         if (!reader.beforeMessageRead())
             return false;
 
-        switch (readState) {
+        switch (reader.state()) {
             case 0:
                 siblingsBytes = reader.readByteArray("siblingsBytes");
 
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ad02d6e3/modules/core/src/main/java/org/apache/ignite/internal/GridTaskCancelRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridTaskCancelRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/GridTaskCancelRequest.java
index ea53018..dc7b574 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridTaskCancelRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridTaskCancelRequest.java
@@ -84,20 +84,20 @@ public class GridTaskCancelRequest extends MessageAdapter {
     }
 
     /** {@inheritDoc} */
-    @Override public boolean readFrom(ByteBuffer buf) {
+    @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
         reader.setBuffer(buf);
 
         if (!reader.beforeMessageRead())
             return false;
 
-        switch (readState) {
+        switch (reader.state()) {
             case 0:
                 sesId = reader.readIgniteUuid("sesId");
 
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ad02d6e3/modules/core/src/main/java/org/apache/ignite/internal/GridTaskSessionRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridTaskSessionRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/GridTaskSessionRequest.java
index 91218b6..3de1a4c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridTaskSessionRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridTaskSessionRequest.java
@@ -133,20 +133,20 @@ public class GridTaskSessionRequest extends MessageAdapter implements GridTaskMe
     }
 
     /** {@inheritDoc} */
-    @Override public boolean readFrom(ByteBuffer buf) {
+    @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
         reader.setBuffer(buf);
 
         if (!reader.beforeMessageRead())
             return false;
 
-        switch (readState) {
+        switch (reader.state()) {
             case 0:
                 attrsBytes = reader.readByteArray("attrsBytes");
 
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 1:
                 jobId = reader.readIgniteUuid("jobId");
@@ -154,7 +154,7 @@ public class GridTaskSessionRequest extends MessageAdapter implements GridTaskMe
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 2:
                 sesId = reader.readIgniteUuid("sesId");
@@ -162,7 +162,7 @@ public class GridTaskSessionRequest extends MessageAdapter implements GridTaskMe
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ad02d6e3/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectByteBufferStream.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectByteBufferStream.java b/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectByteBufferStream.java
index a925464..336f184 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectByteBufferStream.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectByteBufferStream.java
@@ -266,6 +266,9 @@ public class DirectByteBufferStream {
     /** */
     private boolean lastFinished;
 
+    /** */
+    private MessageReader reader;
+
     /**
      * @param msgFactory Message factory.
      * @param msgFormatter Message formatter.
@@ -558,7 +561,7 @@ public class DirectByteBufferStream {
      * @param itemType Component type.
      * @param writer Writer.
      */
-    public <T> void writeObjectArray(T[] arr, MessageAdapter.Type itemType, MessageWriter writer) {
+    public <T> void writeObjectArray(T[] arr, MessageCollectionItemType itemType, MessageWriter writer) {
         if (arr != null) {
             if (it == null) {
                 writeInt(arr.length);
@@ -592,7 +595,7 @@ public class DirectByteBufferStream {
      * @param itemType Item type.
      * @param writer Writer.
      */
-    public <T> void writeCollection(Collection<T> col, MessageAdapter.Type itemType, MessageWriter writer) {
+    public <T> void writeCollection(Collection<T> col, MessageCollectionItemType itemType, MessageWriter writer) {
         if (col != null) {
             if (it == null) {
                 writeInt(col.size());
@@ -628,7 +631,7 @@ public class DirectByteBufferStream {
      * @param writer Writer.
      */
     @SuppressWarnings("unchecked")
-    public <K, V> void writeMap(Map<K, V> map, MessageAdapter.Type keyType, MessageAdapter.Type valType,
+    public <K, V> void writeMap(Map<K, V> map, MessageCollectionItemType keyType, MessageCollectionItemType valType,
         MessageWriter writer) {
         if (map != null) {
             if (it == null) {
@@ -918,12 +921,12 @@ public class DirectByteBufferStream {
             msg = type == Byte.MIN_VALUE ? null : msgFactory.create(type);
 
             if (msg != null)
-                msg.setReader(msgFormatter.reader(msgFactory));
+                reader = msgFormatter.reader(msgFactory);
 
             msgTypeDone = true;
         }
 
-        lastFinished = msg == null || msg.readFrom(buf);
+        lastFinished = msg == null || msg.readFrom(buf, reader);
 
         if (lastFinished) {
             MessageAdapter msg0 = msg;
@@ -943,7 +946,7 @@ public class DirectByteBufferStream {
      * @return Array.
      */
     @SuppressWarnings("unchecked")
-    public <T> T[] readObjectArray(MessageAdapter.Type itemType, Class<T> itemCls) {
+    public <T> T[] readObjectArray(MessageCollectionItemType itemType, Class<T> itemCls) {
         if (readSize == -1) {
             int size = readInt();
 
@@ -985,7 +988,7 @@ public class DirectByteBufferStream {
      * @return Collection.
      */
     @SuppressWarnings("unchecked")
-    public <C extends Collection<?>> C readCollection(MessageAdapter.Type itemType) {
+    public <C extends Collection<?>> C readCollection(MessageCollectionItemType itemType) {
         if (readSize == -1) {
             int size = readInt();
 
@@ -1029,7 +1032,7 @@ public class DirectByteBufferStream {
      * @return Map.
      */
     @SuppressWarnings("unchecked")
-    public <M extends Map<?, ?>> M readMap(MessageAdapter.Type keyType, MessageAdapter.Type valType, boolean linked) {
+    public <M extends Map<?, ?>> M readMap(MessageCollectionItemType keyType, MessageCollectionItemType valType, boolean linked) {
         if (readSize == -1) {
             int size = readInt();
 
@@ -1228,7 +1231,7 @@ public class DirectByteBufferStream {
      * @param val Value.
      * @param writer Writer.
      */
-    private void write(MessageAdapter.Type type, Object val, MessageWriter writer) {
+    private void write(MessageCollectionItemType type, Object val, MessageWriter writer) {
         switch (type) {
             case BYTE:
                 writeByte((Byte)val);
@@ -1353,7 +1356,7 @@ public class DirectByteBufferStream {
      * @param type Type.
      * @return Value.
      */
-    private Object read(MessageAdapter.Type type) {
+    private Object read(MessageCollectionItemType type) {
         switch (type) {
             case BYTE:
                 return readByte();

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ad02d6e3/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectMessageReader.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectMessageReader.java b/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectMessageReader.java
index be8e38a..691af4a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectMessageReader.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectMessageReader.java
@@ -34,6 +34,9 @@ public class DirectMessageReader implements MessageReader {
     /** Whether last field was fully read. */
     private boolean lastRead;
 
+    /** Current state. */
+    private int state;
+
     /**
      * @param msgFactory Message factory.
      * @param msgFormatter Message formatter.
@@ -242,7 +245,7 @@ public class DirectMessageReader implements MessageReader {
     }
 
     /** {@inheritDoc} */
-    @Override public <T> T[] readObjectArray(String name, MessageAdapter.Type itemType, Class<T> itemCls) {
+    @Override public <T> T[] readObjectArray(String name, MessageCollectionItemType itemType, Class<T> itemCls) {
         T[] msg = stream.readObjectArray(itemType, itemCls);
 
         lastRead = stream.lastFinished();
@@ -251,7 +254,7 @@ public class DirectMessageReader implements MessageReader {
     }
 
     /** {@inheritDoc} */
-    @Override public <C extends Collection<?>> C readCollection(String name, MessageAdapter.Type itemType) {
+    @Override public <C extends Collection<?>> C readCollection(String name, MessageCollectionItemType itemType) {
         C col = stream.readCollection(itemType);
 
         lastRead = stream.lastFinished();
@@ -260,8 +263,8 @@ public class DirectMessageReader implements MessageReader {
     }
 
     /** {@inheritDoc} */
-    @Override public <M extends Map<?, ?>> M readMap(String name, MessageAdapter.Type keyType,
-        MessageAdapter.Type valType, boolean linked) {
+    @Override public <M extends Map<?, ?>> M readMap(String name, MessageCollectionItemType keyType,
+        MessageCollectionItemType valType, boolean linked) {
         M map = stream.readMap(keyType, valType, linked);
 
         lastRead = stream.lastFinished();
@@ -273,4 +276,14 @@ public class DirectMessageReader implements MessageReader {
     @Override public boolean isLastRead() {
         return lastRead;
     }
+
+    /** {@inheritDoc} */
+    @Override public int state() {
+        return state;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void incrementState() {
+        state++;
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ad02d6e3/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectMessageWriter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectMessageWriter.java b/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectMessageWriter.java
index a2bac87..5ed5659 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectMessageWriter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/direct/DirectMessageWriter.java
@@ -194,22 +194,22 @@ public class DirectMessageWriter implements MessageWriter {
     }
 
     /** {@inheritDoc} */
-    @Override public <T> boolean writeObjectArray(String name, T[] arr, MessageAdapter.Type itemType) {
+    @Override public <T> boolean writeObjectArray(String name, T[] arr, MessageCollectionItemType itemType) {
         stream.writeObjectArray(arr, itemType, this);
 
         return stream.lastFinished();
     }
 
     /** {@inheritDoc} */
-    @Override public <T> boolean writeCollection(String name, Collection<T> col, MessageAdapter.Type itemType) {
+    @Override public <T> boolean writeCollection(String name, Collection<T> col, MessageCollectionItemType itemType) {
         stream.writeCollection(col, itemType, this);
 
         return stream.lastFinished();
     }
 
     /** {@inheritDoc} */
-    @Override public <K, V> boolean writeMap(String name, Map<K, V> map, MessageAdapter.Type keyType,
-        MessageAdapter.Type valType) {
+    @Override public <K, V> boolean writeMap(String name, Map<K, V> map, MessageCollectionItemType keyType,
+        MessageCollectionItemType valType) {
         stream.writeMap(map, keyType, valType, this);
 
         return stream.lastFinished();

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ad02d6e3/modules/core/src/main/java/org/apache/ignite/internal/managers/checkpoint/GridCheckpointRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/checkpoint/GridCheckpointRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/checkpoint/GridCheckpointRequest.java
index 95c94ea..83ac15b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/checkpoint/GridCheckpointRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/checkpoint/GridCheckpointRequest.java
@@ -119,20 +119,20 @@ public class GridCheckpointRequest extends MessageAdapter {
     }
 
     /** {@inheritDoc} */
-    @Override public boolean readFrom(ByteBuffer buf) {
+    @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
         reader.setBuffer(buf);
 
         if (!reader.beforeMessageRead())
             return false;
 
-        switch (readState) {
+        switch (reader.state()) {
             case 0:
                 cpSpi = reader.readString("cpSpi");
 
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 1:
                 key = reader.readString("key");
@@ -140,7 +140,7 @@ public class GridCheckpointRequest extends MessageAdapter {
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 2:
                 sesId = reader.readIgniteUuid("sesId");
@@ -148,7 +148,7 @@ public class GridCheckpointRequest extends MessageAdapter {
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ad02d6e3/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessage.java
index 28aad2b..3cdfb31 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoMessage.java
@@ -238,20 +238,20 @@ public class GridIoMessage extends MessageAdapter {
     }
 
     /** {@inheritDoc} */
-    @Override public boolean readFrom(ByteBuffer buf) {
+    @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
         reader.setBuffer(buf);
 
         if (!reader.beforeMessageRead())
             return false;
 
-        switch (readState) {
+        switch (reader.state()) {
             case 0:
                 msg = reader.readMessage("msg");
 
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 1:
                 ordered = reader.readBoolean("ordered");
@@ -259,7 +259,7 @@ public class GridIoMessage extends MessageAdapter {
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 2:
                 byte plcOrd;
@@ -271,7 +271,7 @@ public class GridIoMessage extends MessageAdapter {
 
                 plc = GridIoPolicy.fromOrdinal(plcOrd);
 
-                readState++;
+                reader.incrementState();
 
             case 3:
                 skipOnTimeout = reader.readBoolean("skipOnTimeout");
@@ -279,7 +279,7 @@ public class GridIoMessage extends MessageAdapter {
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 4:
                 timeout = reader.readLong("timeout");
@@ -287,7 +287,7 @@ public class GridIoMessage extends MessageAdapter {
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 5:
                 topicBytes = reader.readByteArray("topicBytes");
@@ -295,7 +295,7 @@ public class GridIoMessage extends MessageAdapter {
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 6:
                 topicOrd = reader.readInt("topicOrd");
@@ -303,7 +303,7 @@ public class GridIoMessage extends MessageAdapter {
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ad02d6e3/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoUserMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoUserMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoUserMessage.java
index 417addc..9051d6c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoUserMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoUserMessage.java
@@ -239,7 +239,7 @@ public class GridIoUserMessage extends MessageAdapter {
                 writer.incrementState();
 
             case 4:
-                if (!writer.writeMap("ldrParties", ldrParties, Type.UUID, Type.IGNITE_UUID))
+                if (!writer.writeMap("ldrParties", ldrParties, MessageCollectionItemType.UUID, MessageCollectionItemType.IGNITE_UUID))
                     return false;
 
                 writer.incrementState();
@@ -262,20 +262,20 @@ public class GridIoUserMessage extends MessageAdapter {
     }
 
     /** {@inheritDoc} */
-    @Override public boolean readFrom(ByteBuffer buf) {
+    @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
         reader.setBuffer(buf);
 
         if (!reader.beforeMessageRead())
             return false;
 
-        switch (readState) {
+        switch (reader.state()) {
             case 0:
                 bodyBytes = reader.readByteArray("bodyBytes");
 
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 1:
                 clsLdrId = reader.readIgniteUuid("clsLdrId");
@@ -283,7 +283,7 @@ public class GridIoUserMessage extends MessageAdapter {
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 2:
                 depClsName = reader.readString("depClsName");
@@ -291,7 +291,7 @@ public class GridIoUserMessage extends MessageAdapter {
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 3:
                 byte depModeOrd;
@@ -303,15 +303,15 @@ public class GridIoUserMessage extends MessageAdapter {
 
                 depMode = DeploymentMode.fromOrdinal(depModeOrd);
 
-                readState++;
+                reader.incrementState();
 
             case 4:
-                ldrParties = reader.readMap("ldrParties", Type.UUID, Type.IGNITE_UUID, false);
+                ldrParties = reader.readMap("ldrParties", MessageCollectionItemType.UUID, MessageCollectionItemType.IGNITE_UUID, false);
 
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 5:
                 topicBytes = reader.readByteArray("topicBytes");
@@ -319,7 +319,7 @@ public class GridIoUserMessage extends MessageAdapter {
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 6:
                 userVer = reader.readString("userVer");
@@ -327,7 +327,7 @@ public class GridIoUserMessage extends MessageAdapter {
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ad02d6e3/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentInfoBean.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentInfoBean.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentInfoBean.java
index 71154e9..189ba1e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentInfoBean.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentInfoBean.java
@@ -168,7 +168,7 @@ public class GridDeploymentInfoBean extends MessageAdapter implements GridDeploy
                 writer.incrementState();
 
             case 3:
-                if (!writer.writeMap("participants", participants, Type.UUID, Type.IGNITE_UUID))
+                if (!writer.writeMap("participants", participants, MessageCollectionItemType.UUID, MessageCollectionItemType.IGNITE_UUID))
                     return false;
 
                 writer.incrementState();
@@ -185,20 +185,20 @@ public class GridDeploymentInfoBean extends MessageAdapter implements GridDeploy
     }
 
     /** {@inheritDoc} */
-    @Override public boolean readFrom(ByteBuffer buf) {
+    @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
         reader.setBuffer(buf);
 
         if (!reader.beforeMessageRead())
             return false;
 
-        switch (readState) {
+        switch (reader.state()) {
             case 0:
                 clsLdrId = reader.readIgniteUuid("clsLdrId");
 
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 1:
                 byte depModeOrd;
@@ -210,7 +210,7 @@ public class GridDeploymentInfoBean extends MessageAdapter implements GridDeploy
 
                 depMode = DeploymentMode.fromOrdinal(depModeOrd);
 
-                readState++;
+                reader.incrementState();
 
             case 2:
                 locDepOwner = reader.readBoolean("locDepOwner");
@@ -218,15 +218,15 @@ public class GridDeploymentInfoBean extends MessageAdapter implements GridDeploy
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 3:
-                participants = reader.readMap("participants", Type.UUID, Type.IGNITE_UUID, false);
+                participants = reader.readMap("participants", MessageCollectionItemType.UUID, MessageCollectionItemType.IGNITE_UUID, false);
 
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 4:
                 userVer = reader.readString("userVer");
@@ -234,7 +234,7 @@ public class GridDeploymentInfoBean extends MessageAdapter implements GridDeploy
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ad02d6e3/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentRequest.java
index 8d882a5..199b7d7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentRequest.java
@@ -180,7 +180,7 @@ public class GridDeploymentRequest extends MessageAdapter {
                 writer.incrementState();
 
             case 2:
-                if (!writer.writeCollection("nodeIds", nodeIds, Type.UUID))
+                if (!writer.writeCollection("nodeIds", nodeIds, MessageCollectionItemType.UUID))
                     return false;
 
                 writer.incrementState();
@@ -203,20 +203,20 @@ public class GridDeploymentRequest extends MessageAdapter {
     }
 
     /** {@inheritDoc} */
-    @Override public boolean readFrom(ByteBuffer buf) {
+    @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
         reader.setBuffer(buf);
 
         if (!reader.beforeMessageRead())
             return false;
 
-        switch (readState) {
+        switch (reader.state()) {
             case 0:
                 isUndeploy = reader.readBoolean("isUndeploy");
 
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 1:
                 ldrId = reader.readIgniteUuid("ldrId");
@@ -224,15 +224,15 @@ public class GridDeploymentRequest extends MessageAdapter {
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 2:
-                nodeIds = reader.readCollection("nodeIds", Type.UUID);
+                nodeIds = reader.readCollection("nodeIds", MessageCollectionItemType.UUID);
 
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 3:
                 resTopicBytes = reader.readByteArray("resTopicBytes");
@@ -240,7 +240,7 @@ public class GridDeploymentRequest extends MessageAdapter {
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 4:
                 rsrcName = reader.readString("rsrcName");
@@ -248,7 +248,7 @@ public class GridDeploymentRequest extends MessageAdapter {
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ad02d6e3/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentResponse.java
index 5affd76..2101405 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentResponse.java
@@ -141,20 +141,20 @@ public class GridDeploymentResponse extends MessageAdapter {
     }
 
     /** {@inheritDoc} */
-    @Override public boolean readFrom(ByteBuffer buf) {
+    @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
         reader.setBuffer(buf);
 
         if (!reader.beforeMessageRead())
             return false;
 
-        switch (readState) {
+        switch (reader.state()) {
             case 0:
                 byteSrc = reader.readMessage("byteSrc");
 
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 1:
                 errMsg = reader.readString("errMsg");
@@ -162,7 +162,7 @@ public class GridDeploymentResponse extends MessageAdapter {
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 2:
                 success = reader.readBoolean("success");
@@ -170,7 +170,7 @@ public class GridDeploymentResponse extends MessageAdapter {
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ad02d6e3/modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/GridEventStorageMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/GridEventStorageMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/GridEventStorageMessage.java
index 85ed86d..4b7c24c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/GridEventStorageMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/eventstorage/GridEventStorageMessage.java
@@ -309,7 +309,7 @@ public class GridEventStorageMessage extends MessageAdapter {
                 writer.incrementState();
 
             case 6:
-                if (!writer.writeMap("ldrParties", ldrParties, Type.UUID, Type.IGNITE_UUID))
+                if (!writer.writeMap("ldrParties", ldrParties, MessageCollectionItemType.UUID, MessageCollectionItemType.IGNITE_UUID))
                     return false;
 
                 writer.incrementState();
@@ -332,20 +332,20 @@ public class GridEventStorageMessage extends MessageAdapter {
     }
 
     /** {@inheritDoc} */
-    @Override public boolean readFrom(ByteBuffer buf) {
+    @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
         reader.setBuffer(buf);
 
         if (!reader.beforeMessageRead())
             return false;
 
-        switch (readState) {
+        switch (reader.state()) {
             case 0:
                 clsLdrId = reader.readIgniteUuid("clsLdrId");
 
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 1:
                 byte depModeOrd;
@@ -357,7 +357,7 @@ public class GridEventStorageMessage extends MessageAdapter {
 
                 depMode = DeploymentMode.fromOrdinal(depModeOrd);
 
-                readState++;
+                reader.incrementState();
 
             case 2:
                 evtsBytes = reader.readByteArray("evtsBytes");
@@ -365,7 +365,7 @@ public class GridEventStorageMessage extends MessageAdapter {
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 3:
                 exBytes = reader.readByteArray("exBytes");
@@ -373,7 +373,7 @@ public class GridEventStorageMessage extends MessageAdapter {
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 4:
                 filter = reader.readByteArray("filter");
@@ -381,7 +381,7 @@ public class GridEventStorageMessage extends MessageAdapter {
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 5:
                 filterClsName = reader.readString("filterClsName");
@@ -389,15 +389,15 @@ public class GridEventStorageMessage extends MessageAdapter {
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 6:
-                ldrParties = reader.readMap("ldrParties", Type.UUID, Type.IGNITE_UUID, false);
+                ldrParties = reader.readMap("ldrParties", MessageCollectionItemType.UUID, MessageCollectionItemType.IGNITE_UUID, false);
 
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 7:
                 resTopicBytes = reader.readByteArray("resTopicBytes");
@@ -405,7 +405,7 @@ public class GridEventStorageMessage extends MessageAdapter {
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 8:
                 userVer = reader.readString("userVer");
@@ -413,7 +413,7 @@ public class GridEventStorageMessage extends MessageAdapter {
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ad02d6e3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionRequest.java
index 6fe328c..676144d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionRequest.java
@@ -178,23 +178,23 @@ public class GridCacheEvictionRequest<K, V> extends GridCacheMessage<K, V> imple
     }
 
     /** {@inheritDoc} */
-    @Override public boolean readFrom(ByteBuffer buf) {
+    @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
         reader.setBuffer(buf);
 
         if (!reader.beforeMessageRead())
             return false;
 
-        if (!super.readFrom(buf))
+        if (!super.readFrom(buf, reader))
             return false;
 
-        switch (readState) {
+        switch (reader.state()) {
             case 3:
                 entriesBytes = reader.readByteArray("entriesBytes");
 
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 4:
                 futId = reader.readLong("futId");
@@ -202,7 +202,7 @@ public class GridCacheEvictionRequest<K, V> extends GridCacheMessage<K, V> imple
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 5:
                 topVer = reader.readLong("topVer");
@@ -210,7 +210,7 @@ public class GridCacheEvictionRequest<K, V> extends GridCacheMessage<K, V> imple
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ad02d6e3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionResponse.java
index b3c96e3..528e578 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionResponse.java
@@ -156,7 +156,7 @@ public class GridCacheEvictionResponse<K, V> extends GridCacheMessage<K, V> {
                 writer.incrementState();
 
             case 5:
-                if (!writer.writeCollection("rejectedKeyBytes", rejectedKeyBytes, Type.BYTE_ARR))
+                if (!writer.writeCollection("rejectedKeyBytes", rejectedKeyBytes, MessageCollectionItemType.BYTE_ARR))
                     return false;
 
                 writer.incrementState();
@@ -167,23 +167,23 @@ public class GridCacheEvictionResponse<K, V> extends GridCacheMessage<K, V> {
     }
 
     /** {@inheritDoc} */
-    @Override public boolean readFrom(ByteBuffer buf) {
+    @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
         reader.setBuffer(buf);
 
         if (!reader.beforeMessageRead())
             return false;
 
-        if (!super.readFrom(buf))
+        if (!super.readFrom(buf, reader))
             return false;
 
-        switch (readState) {
+        switch (reader.state()) {
             case 3:
                 err = reader.readBoolean("err");
 
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 4:
                 futId = reader.readLong("futId");
@@ -191,15 +191,15 @@ public class GridCacheEvictionResponse<K, V> extends GridCacheMessage<K, V> {
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 5:
-                rejectedKeyBytes = reader.readCollection("rejectedKeyBytes", Type.BYTE_ARR);
+                rejectedKeyBytes = reader.readCollection("rejectedKeyBytes", MessageCollectionItemType.BYTE_ARR);
 
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ad02d6e3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMessage.java
----------------------------------------------------------------------
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 fe44305..091a8d9 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
@@ -681,20 +681,20 @@ public abstract class GridCacheMessage<K, V> extends MessageAdapter {
     }
 
     /** {@inheritDoc} */
-    @Override public boolean readFrom(ByteBuffer buf) {
+    @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
         reader.setBuffer(buf);
 
         if (!reader.beforeMessageRead())
             return false;
 
-        switch (readState) {
+        switch (reader.state()) {
             case 0:
                 cacheId = reader.readInt("cacheId");
 
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 1:
                 depInfo = reader.readMessage("depInfo");
@@ -702,7 +702,7 @@ public abstract class GridCacheMessage<K, V> extends MessageAdapter {
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 2:
                 msgId = reader.readLong("msgId");
@@ -710,7 +710,7 @@ public abstract class GridCacheMessage<K, V> extends MessageAdapter {
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ad02d6e3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheValueBytes.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheValueBytes.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheValueBytes.java
index b3a16c4..c866452 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheValueBytes.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheValueBytes.java
@@ -149,20 +149,20 @@ public class GridCacheValueBytes extends MessageAdapter {
     }
 
     /** {@inheritDoc} */
-    @Override public boolean readFrom(ByteBuffer buf) {
+    @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
         reader.setBuffer(buf);
 
         if (!reader.beforeMessageRead())
             return false;
 
-        switch (readState) {
+        switch (reader.state()) {
             case 0:
                 bytes = reader.readByteArray("bytes");
 
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 1:
                 plain = reader.readBoolean("plain");
@@ -170,7 +170,7 @@ public class GridCacheValueBytes extends MessageAdapter {
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ad02d6e3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxRequest.java
index 0dafb72..c8fb590 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxRequest.java
@@ -160,23 +160,23 @@ public class GridCacheOptimisticCheckPreparedTxRequest<K, V> extends GridDistrib
     }
 
     /** {@inheritDoc} */
-    @Override public boolean readFrom(ByteBuffer buf) {
+    @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
         reader.setBuffer(buf);
 
         if (!reader.beforeMessageRead())
             return false;
 
-        if (!super.readFrom(buf))
+        if (!super.readFrom(buf, reader))
             return false;
 
-        switch (readState) {
+        switch (reader.state()) {
             case 8:
                 futId = reader.readIgniteUuid("futId");
 
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 9:
                 miniId = reader.readIgniteUuid("miniId");
@@ -184,7 +184,7 @@ public class GridCacheOptimisticCheckPreparedTxRequest<K, V> extends GridDistrib
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 10:
                 nearXidVer = reader.readMessage("nearXidVer");
@@ -192,7 +192,7 @@ public class GridCacheOptimisticCheckPreparedTxRequest<K, V> extends GridDistrib
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 11:
                 sys = reader.readBoolean("sys");
@@ -200,7 +200,7 @@ public class GridCacheOptimisticCheckPreparedTxRequest<K, V> extends GridDistrib
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 12:
                 txNum = reader.readInt("txNum");
@@ -208,7 +208,7 @@ public class GridCacheOptimisticCheckPreparedTxRequest<K, V> extends GridDistrib
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ad02d6e3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxResponse.java
index a1650b2..a575be5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheOptimisticCheckPreparedTxResponse.java
@@ -123,23 +123,23 @@ public class GridCacheOptimisticCheckPreparedTxResponse<K, V> extends GridDistri
     }
 
     /** {@inheritDoc} */
-    @Override public boolean readFrom(ByteBuffer buf) {
+    @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
         reader.setBuffer(buf);
 
         if (!reader.beforeMessageRead())
             return false;
 
-        if (!super.readFrom(buf))
+        if (!super.readFrom(buf, reader))
             return false;
 
-        switch (readState) {
+        switch (reader.state()) {
             case 8:
                 futId = reader.readIgniteUuid("futId");
 
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 9:
                 miniId = reader.readIgniteUuid("miniId");
@@ -147,7 +147,7 @@ public class GridCacheOptimisticCheckPreparedTxResponse<K, V> extends GridDistri
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 10:
                 success = reader.readBoolean("success");
@@ -155,7 +155,7 @@ public class GridCacheOptimisticCheckPreparedTxResponse<K, V> extends GridDistri
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ad02d6e3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTtlUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTtlUpdateRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTtlUpdateRequest.java
index 9d52b9f..b2f6abc 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTtlUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTtlUpdateRequest.java
@@ -197,19 +197,19 @@ public class GridCacheTtlUpdateRequest<K, V> extends GridCacheMessage<K, V> {
 
         switch (writer.state()) {
             case 3:
-                if (!writer.writeCollection("keysBytes", keysBytes, Type.BYTE_ARR))
+                if (!writer.writeCollection("keysBytes", keysBytes, MessageCollectionItemType.BYTE_ARR))
                     return false;
 
                 writer.incrementState();
 
             case 4:
-                if (!writer.writeCollection("nearKeysBytes", nearKeysBytes, Type.BYTE_ARR))
+                if (!writer.writeCollection("nearKeysBytes", nearKeysBytes, MessageCollectionItemType.BYTE_ARR))
                     return false;
 
                 writer.incrementState();
 
             case 5:
-                if (!writer.writeCollection("nearVers", nearVers, Type.MSG))
+                if (!writer.writeCollection("nearVers", nearVers, MessageCollectionItemType.MSG))
                     return false;
 
                 writer.incrementState();
@@ -227,7 +227,7 @@ public class GridCacheTtlUpdateRequest<K, V> extends GridCacheMessage<K, V> {
                 writer.incrementState();
 
             case 8:
-                if (!writer.writeCollection("vers", vers, Type.MSG))
+                if (!writer.writeCollection("vers", vers, MessageCollectionItemType.MSG))
                     return false;
 
                 writer.incrementState();
@@ -238,39 +238,39 @@ public class GridCacheTtlUpdateRequest<K, V> extends GridCacheMessage<K, V> {
     }
 
     /** {@inheritDoc} */
-    @Override public boolean readFrom(ByteBuffer buf) {
+    @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
         reader.setBuffer(buf);
 
         if (!reader.beforeMessageRead())
             return false;
 
-        if (!super.readFrom(buf))
+        if (!super.readFrom(buf, reader))
             return false;
 
-        switch (readState) {
+        switch (reader.state()) {
             case 3:
-                keysBytes = reader.readCollection("keysBytes", Type.BYTE_ARR);
+                keysBytes = reader.readCollection("keysBytes", MessageCollectionItemType.BYTE_ARR);
 
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 4:
-                nearKeysBytes = reader.readCollection("nearKeysBytes", Type.BYTE_ARR);
+                nearKeysBytes = reader.readCollection("nearKeysBytes", MessageCollectionItemType.BYTE_ARR);
 
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 5:
-                nearVers = reader.readCollection("nearVers", Type.MSG);
+                nearVers = reader.readCollection("nearVers", MessageCollectionItemType.MSG);
 
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 6:
                 topVer = reader.readLong("topVer");
@@ -278,7 +278,7 @@ public class GridCacheTtlUpdateRequest<K, V> extends GridCacheMessage<K, V> {
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 7:
                 ttl = reader.readLong("ttl");
@@ -286,15 +286,15 @@ public class GridCacheTtlUpdateRequest<K, V> extends GridCacheMessage<K, V> {
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 8:
-                vers = reader.readCollection("vers", Type.MSG);
+                vers = reader.readCollection("vers", MessageCollectionItemType.MSG);
 
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ad02d6e3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedBaseMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedBaseMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedBaseMessage.java
index f4d64dc..a13238c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedBaseMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedBaseMessage.java
@@ -267,13 +267,13 @@ public abstract class GridDistributedBaseMessage<K, V> extends GridCacheMessage<
                 writer.incrementState();
 
             case 5:
-                if (!writer.writeCollection("committedVers", committedVers, Type.MSG))
+                if (!writer.writeCollection("committedVers", committedVers, MessageCollectionItemType.MSG))
                     return false;
 
                 writer.incrementState();
 
             case 6:
-                if (!writer.writeCollection("rolledbackVers", rolledbackVers, Type.MSG))
+                if (!writer.writeCollection("rolledbackVers", rolledbackVers, MessageCollectionItemType.MSG))
                     return false;
 
                 writer.incrementState();
@@ -290,23 +290,23 @@ public abstract class GridDistributedBaseMessage<K, V> extends GridCacheMessage<
     }
 
     /** {@inheritDoc} */
-    @Override public boolean readFrom(ByteBuffer buf) {
+    @Override public boolean readFrom(ByteBuffer buf, MessageReader reader) {
         reader.setBuffer(buf);
 
         if (!reader.beforeMessageRead())
             return false;
 
-        if (!super.readFrom(buf))
+        if (!super.readFrom(buf, reader))
             return false;
 
-        switch (readState) {
+        switch (reader.state()) {
             case 3:
                 candsByIdxBytes = reader.readByteArray("candsByIdxBytes");
 
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 4:
                 candsByKeyBytes = reader.readByteArray("candsByKeyBytes");
@@ -314,23 +314,23 @@ public abstract class GridDistributedBaseMessage<K, V> extends GridCacheMessage<
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 5:
-                committedVers = reader.readCollection("committedVers", Type.MSG);
+                committedVers = reader.readCollection("committedVers", MessageCollectionItemType.MSG);
 
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 6:
-                rolledbackVers = reader.readCollection("rolledbackVers", Type.MSG);
+                rolledbackVers = reader.readCollection("rolledbackVers", MessageCollectionItemType.MSG);
 
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
             case 7:
                 ver = reader.readMessage("ver");
@@ -338,7 +338,7 @@ public abstract class GridDistributedBaseMessage<K, V> extends GridCacheMessage<
                 if (!reader.isLastRead())
                     return false;
 
-                readState++;
+                reader.incrementState();
 
         }
 


Mime
View raw message