ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vkuliche...@apache.org
Subject [2/6] incubator-ignite git commit: ignite-nio - Removing message clone
Date Sun, 15 Feb 2015 03:08:48 GMT
ignite-nio - Removing message clone


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

Branch: refs/heads/ignite-nio
Commit: d674a080ec0588a6ed11410fc332d9554e00efce
Parents: a3fe933
Author: Valentin Kulichenko <vkulichenko@gridgain.com>
Authored: Sat Feb 14 18:08:06 2015 -0800
Committer: Valentin Kulichenko <vkulichenko@gridgain.com>
Committed: Sat Feb 14 18:08:06 2015 -0800

----------------------------------------------------------------------
 .../CommunicationMessageCodeGenerator.java      | 20 ++++++++++++++++----
 .../ignite/internal/GridJobExecuteRequest.java  |  8 ++++++--
 .../internal/direct/DirectByteBufferStream.java | 18 ------------------
 .../internal/direct/DirectMessageReader.java    |  9 ---------
 .../internal/direct/DirectMessageWriter.java    |  7 -------
 .../managers/communication/GridIoMessage.java   |  8 ++++++--
 .../communication/GridIoUserMessage.java        |  8 ++++++--
 .../deployment/GridDeploymentInfoBean.java      |  8 ++++++--
 .../eventstorage/GridEventStorageMessage.java   |  8 ++++++--
 .../distributed/GridDistributedLockRequest.java |  8 ++++++--
 .../GridDistributedTxPrepareRequest.java        | 16 ++++++++++++----
 .../distributed/dht/GridDhtTxFinishRequest.java |  8 ++++++--
 .../dht/atomic/GridDhtAtomicUpdateRequest.java  |  8 ++++++--
 .../dht/atomic/GridNearAtomicUpdateRequest.java | 16 ++++++++++++----
 .../cache/query/GridCacheQueryRequest.java      |  8 ++++++--
 .../continuous/GridContinuousMessage.java       |  8 ++++++--
 .../dataload/GridDataLoadRequest.java           |  8 ++++++--
 .../streamer/GridStreamerExecutionRequest.java  |  8 ++++++--
 .../extensions/communication/MessageReader.java |  9 ---------
 .../extensions/communication/MessageWriter.java |  9 ---------
 20 files changed, 112 insertions(+), 88 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d674a080/modules/codegen/src/main/java/org/apache/ignite/codegen/CommunicationMessageCodeGenerator.java
----------------------------------------------------------------------
diff --git a/modules/codegen/src/main/java/org/apache/ignite/codegen/CommunicationMessageCodeGenerator.java
b/modules/codegen/src/main/java/org/apache/ignite/codegen/CommunicationMessageCodeGenerator.java
index 53808c1..c163684 100644
--- a/modules/codegen/src/main/java/org/apache/ignite/codegen/CommunicationMessageCodeGenerator.java
+++ b/modules/codegen/src/main/java/org/apache/ignite/codegen/CommunicationMessageCodeGenerator.java
@@ -531,8 +531,11 @@ public class CommunicationMessageCodeGenerator {
             returnFalseIfFailed(write, "writer.writeUuid", field, name);
         else if (type == IgniteUuid.class)
             returnFalseIfFailed(write, "writer.writeIgniteUuid", field, name);
-        else if (type.isEnum())
-            returnFalseIfFailed(write, "writer.writeEnum", field, name);
+        else if (type.isEnum()) {
+            String arg = name + " != null ? (byte)" + name + ".ordinal() : -1";
+
+            returnFalseIfFailed(write, "writer.writeByte", field, arg);
+        }
         else if (BASE_CLS.isAssignableFrom(type))
             returnFalseIfFailed(write, "writer.writeMessage", field, name);
         else if (type.isArray()) {
@@ -608,8 +611,17 @@ public class CommunicationMessageCodeGenerator {
             returnFalseIfReadFailed(name, "reader.readUuid", field);
         else if (type == IgniteUuid.class)
             returnFalseIfReadFailed(name, "reader.readIgniteUuid", field);
-        else if (type.isEnum())
-            returnFalseIfReadFailed(name, "reader.readEnum", field, type.getSimpleName()
+ ".class");
+        else if (type.isEnum()) {
+            String loc = name + "Ord";
+
+            read.add(builder().a("byte ").a(loc).a(";").toString());
+            read.add(EMPTY);
+
+            returnFalseIfReadFailed(loc, "reader.readByte", field);
+
+            read.add(EMPTY);
+            read.add(builder().a(name).a(" = ").a(type.getSimpleName()).a(".fromOrdinal(").a(loc).a(");").toString());
+        }
         else if (BASE_CLS.isAssignableFrom(type))
             returnFalseIfReadFailed(name, "reader.readMessage", field);
         else if (type.isArray()) {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d674a080/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 dd6b87a..ba1b22c 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
@@ -477,7 +477,7 @@ public class GridJobExecuteRequest extends MessageAdapter implements GridTaskMes
                 state.increment();
 
             case 2:
-                if (!writer.writeEnum("depMode", depMode))
+                if (!writer.writeByte("depMode", depMode != null ? (byte)depMode.ordinal()
: -1))
                     return false;
 
                 state.increment();
@@ -618,11 +618,15 @@ public class GridJobExecuteRequest extends MessageAdapter implements
GridTaskMes
                 readState++;
 
             case 2:
-                depMode = reader.readEnum("depMode", DeploymentMode.class);
+                byte depModeOrd;
+
+                depModeOrd = reader.readByte("depMode");
 
                 if (!reader.isLastRead())
                     return false;
 
+                depMode = DeploymentMode.fromOrdinal(depModeOrd);
+
                 readState++;
 
             case 3:

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d674a080/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 1f2579f..df969b1 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
@@ -577,13 +577,6 @@ public class DirectByteBufferStream {
     }
 
     /**
-     * @param val Value
-     */
-    public void writeEnum(Enum<?> val) {
-        writeByte(val != null ? (byte)val.ordinal() : -1);
-    }
-
-    /**
      * @param msg Message.
      */
     public void writeMessage(MessageAdapter msg, MessageWriteState state) {
@@ -996,17 +989,6 @@ public class DirectByteBufferStream {
     }
 
     /**
-     * @param enumCls Enum type.
-     * @return Value.
-     */
-    @SuppressWarnings("unchecked")
-    public <T extends Enum<T>> T readEnum(Class<T> enumCls) {
-        byte ord = readByte();
-
-        return ord >= 0 ? (T)GridEnumCache.get(enumCls)[ord] : null;
-    }
-
-    /**
      * @return Message.
      */
     @SuppressWarnings("unchecked")

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d674a080/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 9a3fb3f..f2408c3 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
@@ -227,15 +227,6 @@ public class DirectMessageReader implements MessageReader {
     }
 
     /** {@inheritDoc} */
-    @Override public <T extends Enum<T>> T readEnum(String name, Class<T>
enumCls) {
-        T val = stream.readEnum(enumCls);
-
-        lastRead = stream.lastFinished();
-
-        return val;
-    }
-
-    /** {@inheritDoc} */
     @Nullable @Override public <T extends MessageAdapter> T readMessage(String name)
{
         T msg = stream.readMessage(this);
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d674a080/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 de6179b..c4a14fb 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
@@ -183,13 +183,6 @@ public class DirectMessageWriter implements MessageWriter {
     }
 
     /** {@inheritDoc} */
-    @Override public boolean writeEnum(String name, Enum<?> val) {
-        stream.writeEnum(val);
-
-        return stream.lastFinished();
-    }
-
-    /** {@inheritDoc} */
     @Override public boolean writeMessage(String name, @Nullable MessageAdapter msg) {
 //        if (msg != null)
 //            msg.setWriter(this);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d674a080/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 50dc9ed..56e24f5 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
@@ -227,7 +227,7 @@ public class GridIoMessage extends MessageAdapter {
                 state.increment();
 
             case 2:
-                if (!writer.writeEnum("plc", plc))
+                if (!writer.writeByte("plc", plc != null ? (byte)plc.ordinal() : -1))
                     return false;
 
                 state.increment();
@@ -284,11 +284,15 @@ public class GridIoMessage extends MessageAdapter {
                 readState++;
 
             case 2:
-                plc = reader.readEnum("plc", GridIoPolicy.class);
+                byte plcOrd;
+
+                plcOrd = reader.readByte("plc");
 
                 if (!reader.isLastRead())
                     return false;
 
+                plc = GridIoPolicy.fromOrdinal(plcOrd);
+
                 readState++;
 
             case 3:

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d674a080/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 51b7d57..f1d1430 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
@@ -258,7 +258,7 @@ public class GridIoUserMessage extends MessageAdapter {
                 state.increment();
 
             case 3:
-                if (!writer.writeEnum("depMode", depMode))
+                if (!writer.writeByte("depMode", depMode != null ? (byte)depMode.ordinal()
: -1))
                     return false;
 
                 state.increment();
@@ -317,11 +317,15 @@ public class GridIoUserMessage extends MessageAdapter {
                 readState++;
 
             case 3:
-                depMode = reader.readEnum("depMode", DeploymentMode.class);
+                byte depModeOrd;
+
+                depModeOrd = reader.readByte("depMode");
 
                 if (!reader.isLastRead())
                     return false;
 
+                depMode = DeploymentMode.fromOrdinal(depModeOrd);
+
                 readState++;
 
             case 4:

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d674a080/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 bd80df1..ccb2792 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
@@ -176,7 +176,7 @@ public class GridDeploymentInfoBean extends MessageAdapter implements
GridDeploy
                 state.increment();
 
             case 1:
-                if (!writer.writeEnum("depMode", depMode))
+                if (!writer.writeByte("depMode", depMode != null ? (byte)depMode.ordinal()
: -1))
                     return false;
 
                 state.increment();
@@ -219,11 +219,15 @@ public class GridDeploymentInfoBean extends MessageAdapter implements
GridDeploy
                 readState++;
 
             case 1:
-                depMode = reader.readEnum("depMode", DeploymentMode.class);
+                byte depModeOrd;
+
+                depModeOrd = reader.readByte("depMode");
 
                 if (!reader.isLastRead())
                     return false;
 
+                depMode = DeploymentMode.fromOrdinal(depModeOrd);
+
                 readState++;
 
             case 2:

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d674a080/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 0590987..e7a1189 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
@@ -306,7 +306,7 @@ public class GridEventStorageMessage extends MessageAdapter {
                 state.increment();
 
             case 1:
-                if (!writer.writeEnum("depMode", depMode))
+                if (!writer.writeByte("depMode", depMode != null ? (byte)depMode.ordinal()
: -1))
                     return false;
 
                 state.increment();
@@ -373,11 +373,15 @@ public class GridEventStorageMessage extends MessageAdapter {
                 readState++;
 
             case 1:
-                depMode = reader.readEnum("depMode", DeploymentMode.class);
+                byte depModeOrd;
+
+                depModeOrd = reader.readByte("depMode");
 
                 if (!reader.isLastRead())
                     return false;
 
+                depMode = DeploymentMode.fromOrdinal(depModeOrd);
+
                 readState++;
 
             case 2:

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d674a080/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockRequest.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockRequest.java
index 1b1242a..d69299f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedLockRequest.java
@@ -515,7 +515,7 @@ public class GridDistributedLockRequest<K, V> extends GridDistributedBaseMessage
                 state.increment();
 
             case 14:
-                if (!writer.writeEnum("isolation", isolation))
+                if (!writer.writeByte("isolation", isolation != null ? (byte)isolation.ordinal()
: -1))
                     return false;
 
                 state.increment();
@@ -637,11 +637,15 @@ public class GridDistributedLockRequest<K, V> extends GridDistributedBaseMessage
                 readState++;
 
             case 14:
-                isolation = reader.readEnum("isolation", IgniteTxIsolation.class);
+                byte isolationOrd;
+
+                isolationOrd = reader.readByte("isolation");
 
                 if (!reader.isLastRead())
                     return false;
 
+                isolation = IgniteTxIsolation.fromOrdinal(isolationOrd);
+
                 readState++;
 
             case 15:

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d674a080/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareRequest.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareRequest.java
index d0b4427..d90e3d1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedTxPrepareRequest.java
@@ -460,7 +460,7 @@ public class GridDistributedTxPrepareRequest<K, V> extends GridDistributedBaseMe
                 state.increment();
 
             case 9:
-                if (!writer.writeEnum("concurrency", concurrency))
+                if (!writer.writeByte("concurrency", concurrency != null ? (byte)concurrency.ordinal()
: -1))
                     return false;
 
                 state.increment();
@@ -484,7 +484,7 @@ public class GridDistributedTxPrepareRequest<K, V> extends GridDistributedBaseMe
                 state.increment();
 
             case 13:
-                if (!writer.writeEnum("isolation", isolation))
+                if (!writer.writeByte("isolation", isolation != null ? (byte)isolation.ordinal()
: -1))
                     return false;
 
                 state.increment();
@@ -560,11 +560,15 @@ public class GridDistributedTxPrepareRequest<K, V> extends GridDistributedBaseMe
                 readState++;
 
             case 9:
-                concurrency = reader.readEnum("concurrency", IgniteTxConcurrency.class);
+                byte concurrencyOrd;
+
+                concurrencyOrd = reader.readByte("concurrency");
 
                 if (!reader.isLastRead())
                     return false;
 
+                concurrency = IgniteTxConcurrency.fromOrdinal(concurrencyOrd);
+
                 readState++;
 
             case 10:
@@ -592,11 +596,15 @@ public class GridDistributedTxPrepareRequest<K, V> extends GridDistributedBaseMe
                 readState++;
 
             case 13:
-                isolation = reader.readEnum("isolation", IgniteTxIsolation.class);
+                byte isolationOrd;
+
+                isolationOrd = reader.readByte("isolation");
 
                 if (!reader.isLastRead())
                     return false;
 
+                isolation = IgniteTxIsolation.fromOrdinal(isolationOrd);
+
                 readState++;
 
             case 14:

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d674a080/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java
index 289315a..d2fbf1a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxFinishRequest.java
@@ -394,7 +394,7 @@ public class GridDhtTxFinishRequest<K, V> extends GridDistributedTxFinishRequest
 
         switch (state.index()) {
             case 21:
-                if (!writer.writeEnum("isolation", isolation))
+                if (!writer.writeByte("isolation", isolation != null ? (byte)isolation.ordinal()
: -1))
                     return false;
 
                 state.increment();
@@ -486,11 +486,15 @@ public class GridDhtTxFinishRequest<K, V> extends GridDistributedTxFinishRequest
 
         switch (readState) {
             case 21:
-                isolation = reader.readEnum("isolation", IgniteTxIsolation.class);
+                byte isolationOrd;
+
+                isolationOrd = reader.readByte("isolation");
 
                 if (!reader.isLastRead())
                     return false;
 
+                isolation = IgniteTxIsolation.fromOrdinal(isolationOrd);
+
                 readState++;
 
             case 22:

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d674a080/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
index 598dccb..9267123 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateRequest.java
@@ -824,7 +824,7 @@ public class GridDhtAtomicUpdateRequest<K, V> extends GridCacheMessage<K,
V> imp
                 state.increment();
 
             case 17:
-                if (!writer.writeEnum("syncMode", syncMode))
+                if (!writer.writeByte("syncMode", syncMode != null ? (byte)syncMode.ordinal()
: -1))
                     return false;
 
                 state.increment();
@@ -986,11 +986,15 @@ public class GridDhtAtomicUpdateRequest<K, V> extends GridCacheMessage<K,
V> imp
                 readState++;
 
             case 17:
-                syncMode = reader.readEnum("syncMode", CacheWriteSynchronizationMode.class);
+                byte syncModeOrd;
+
+                syncModeOrd = reader.readByte("syncMode");
 
                 if (!reader.isLastRead())
                     return false;
 
+                syncMode = CacheWriteSynchronizationMode.fromOrdinal(syncModeOrd);
+
                 readState++;
 
             case 18:

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d674a080/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
index e2a8265..1ca6afe 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateRequest.java
@@ -666,7 +666,7 @@ public class GridNearAtomicUpdateRequest<K, V> extends GridCacheMessage<K,
V> im
                 state.increment();
 
             case 14:
-                if (!writer.writeEnum("op", op))
+                if (!writer.writeByte("op", op != null ? (byte)op.ordinal() : -1))
                     return false;
 
                 state.increment();
@@ -684,7 +684,7 @@ public class GridNearAtomicUpdateRequest<K, V> extends GridCacheMessage<K,
V> im
                 state.increment();
 
             case 17:
-                if (!writer.writeEnum("syncMode", syncMode))
+                if (!writer.writeByte("syncMode", syncMode != null ? (byte)syncMode.ordinal()
: -1))
                     return false;
 
                 state.increment();
@@ -816,11 +816,15 @@ public class GridNearAtomicUpdateRequest<K, V> extends GridCacheMessage<K,
V> im
                 readState++;
 
             case 14:
-                op = reader.readEnum("op", GridCacheOperation.class);
+                byte opOrd;
+
+                opOrd = reader.readByte("op");
 
                 if (!reader.isLastRead())
                     return false;
 
+                op = GridCacheOperation.fromOrdinal(opOrd);
+
                 readState++;
 
             case 15:
@@ -840,11 +844,15 @@ public class GridNearAtomicUpdateRequest<K, V> extends GridCacheMessage<K,
V> im
                 readState++;
 
             case 17:
-                syncMode = reader.readEnum("syncMode", CacheWriteSynchronizationMode.class);
+                byte syncModeOrd;
+
+                syncModeOrd = reader.readByte("syncMode");
 
                 if (!reader.isLastRead())
                     return false;
 
+                syncMode = CacheWriteSynchronizationMode.fromOrdinal(syncModeOrd);
+
                 readState++;
 
             case 18:

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d674a080/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryRequest.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryRequest.java
index efe5d0a..8ab6398 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryRequest.java
@@ -605,7 +605,7 @@ public class GridCacheQueryRequest<K, V> extends GridCacheMessage<K,
V> implemen
                 state.increment();
 
             case 21:
-                if (!writer.writeEnum("type", type))
+                if (!writer.writeByte("type", type != null ? (byte)type.ordinal() : -1))
                     return false;
 
                 state.increment();
@@ -769,11 +769,15 @@ public class GridCacheQueryRequest<K, V> extends GridCacheMessage<K,
V> implemen
                 readState++;
 
             case 21:
-                type = reader.readEnum("type", GridCacheQueryType.class);
+                byte typeOrd;
+
+                typeOrd = reader.readByte("type");
 
                 if (!reader.isLastRead())
                     return false;
 
+                type = GridCacheQueryType.fromOrdinal(typeOrd);
+
                 readState++;
 
         }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d674a080/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousMessage.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousMessage.java
index c72125e..1893117 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousMessage.java
@@ -181,7 +181,7 @@ public class GridContinuousMessage extends MessageAdapter {
                 state.increment();
 
             case 3:
-                if (!writer.writeEnum("type", type))
+                if (!writer.writeByte("type", type != null ? (byte)type.ordinal() : -1))
                     return false;
 
                 state.increment();
@@ -222,11 +222,15 @@ public class GridContinuousMessage extends MessageAdapter {
                 readState++;
 
             case 3:
-                type = reader.readEnum("type", GridContinuousMessageType.class);
+                byte typeOrd;
+
+                typeOrd = reader.readByte("type");
 
                 if (!reader.isLastRead())
                     return false;
 
+                type = GridContinuousMessageType.fromOrdinal(typeOrd);
+
                 readState++;
 
         }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d674a080/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/GridDataLoadRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/GridDataLoadRequest.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/GridDataLoadRequest.java
index a4e6ece..7629324 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/GridDataLoadRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/dataload/GridDataLoadRequest.java
@@ -255,7 +255,7 @@ public class GridDataLoadRequest extends MessageAdapter {
                 state.increment();
 
             case 3:
-                if (!writer.writeEnum("depMode", depMode))
+                if (!writer.writeByte("depMode", depMode != null ? (byte)depMode.ordinal()
: -1))
                     return false;
 
                 state.increment();
@@ -349,11 +349,15 @@ public class GridDataLoadRequest extends MessageAdapter {
                 readState++;
 
             case 3:
-                depMode = reader.readEnum("depMode", DeploymentMode.class);
+                byte depModeOrd;
+
+                depModeOrd = reader.readByte("depMode");
 
                 if (!reader.isLastRead())
                     return false;
 
+                depMode = DeploymentMode.fromOrdinal(depModeOrd);
+
                 readState++;
 
             case 4:

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d674a080/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerExecutionRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerExecutionRequest.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerExecutionRequest.java
index 2ea8024..7415523 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerExecutionRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/streamer/GridStreamerExecutionRequest.java
@@ -196,7 +196,7 @@ public class GridStreamerExecutionRequest extends MessageAdapter {
                 state.increment();
 
             case 2:
-                if (!writer.writeEnum("depMode", depMode))
+                if (!writer.writeByte("depMode", depMode != null ? (byte)depMode.ordinal()
: -1))
                     return false;
 
                 state.increment();
@@ -253,11 +253,15 @@ public class GridStreamerExecutionRequest extends MessageAdapter {
                 readState++;
 
             case 2:
-                depMode = reader.readEnum("depMode", DeploymentMode.class);
+                byte depModeOrd;
+
+                depModeOrd = reader.readByte("depMode");
 
                 if (!reader.isLastRead())
                     return false;
 
+                depMode = DeploymentMode.fromOrdinal(depModeOrd);
+
                 readState++;
 
             case 3:

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d674a080/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageReader.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageReader.java
b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageReader.java
index a2c1a68..1e07ef3 100644
--- a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageReader.java
+++ b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageReader.java
@@ -196,15 +196,6 @@ public interface MessageReader {
     public IgniteUuid readIgniteUuid(String name);
 
     /**
-     * Reads {@code enum} value.
-     *
-     * @param name Field name.
-     * @param enumCls {@code enum} type.
-     * @return {@code enum} value.
-     */
-    public <T extends Enum<T>> T readEnum(String name, Class<T> enumCls);
-
-    /**
      * Reads nested message.
      *
      * @param name Field name.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d674a080/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageWriter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageWriter.java
b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageWriter.java
index 89c55a3..278b8e1 100644
--- a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageWriter.java
+++ b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageWriter.java
@@ -216,15 +216,6 @@ public interface MessageWriter {
     public boolean writeIgniteUuid(String name, IgniteUuid val);
 
     /**
-     * Writes {@code enum} value.
-     *
-     * @param name Field name.
-     * @param val {@code enum} value.
-     * @return Whether value was fully written.
-     */
-    public boolean writeEnum(String name, Enum<?> val);
-
-    /**
      * Writes nested message.
      *
      * @param name Field name.


Mime
View raw message