ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vkuliche...@apache.org
Subject [4/6] incubator-ignite git commit: ignite-nio - Removing message clone
Date Sun, 15 Feb 2015 03:08:50 GMT
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ca27b586/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareRequest.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareRequest.java
index e304ce8..b07aa35 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareRequest.java
@@ -268,7 +268,7 @@ public class GridNearTxPrepareRequest<K, V> extends GridDistributedTxPrepareRequ
                 state.increment();
 
             case 24:
-                if (!writer.writeCollection("lastBackups", lastBackups, UUID.class))
+                if (!writer.writeCollection("lastBackups", lastBackups, Type.UUID))
                     return false;
 
                 state.increment();
@@ -334,7 +334,7 @@ public class GridNearTxPrepareRequest<K, V> extends GridDistributedTxPrepareRequ
                 readState++;
 
             case 24:
-                lastBackups = reader.readCollection("lastBackups", UUID.class);
+                lastBackups = reader.readCollection("lastBackups", Type.UUID);
 
                 if (!reader.isLastRead())
                     return false;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ca27b586/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponse.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponse.java
index 6fb9259..94e179e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxPrepareResponse.java
@@ -275,7 +275,7 @@ public class GridNearTxPrepareResponse<K, V> extends GridDistributedTxPrepareRes
                 state.increment();
 
             case 12:
-                if (!writer.writeCollection("invalidParts", invalidParts, int.class))
+                if (!writer.writeCollection("invalidParts", invalidParts, Type.INT))
                     return false;
 
                 state.increment();
@@ -287,13 +287,13 @@ public class GridNearTxPrepareResponse<K, V> extends GridDistributedTxPrepareRes
                 state.increment();
 
             case 14:
-                if (!writer.writeCollection("ownedValsBytes", ownedValsBytes, byte[].class))
+                if (!writer.writeCollection("ownedValsBytes", ownedValsBytes, Type.BYTE_ARR))
                     return false;
 
                 state.increment();
 
             case 15:
-                if (!writer.writeCollection("pending", pending, GridCacheVersion.class))
+                if (!writer.writeCollection("pending", pending, Type.MSG))
                     return false;
 
                 state.increment();
@@ -329,7 +329,7 @@ public class GridNearTxPrepareResponse<K, V> extends GridDistributedTxPrepareRes
                 readState++;
 
             case 12:
-                invalidParts = reader.readCollection("invalidParts", int.class);
+                invalidParts = reader.readCollection("invalidParts", Type.INT);
 
                 if (!reader.isLastRead())
                     return false;
@@ -345,7 +345,7 @@ public class GridNearTxPrepareResponse<K, V> extends GridDistributedTxPrepareRes
                 readState++;
 
             case 14:
-                ownedValsBytes = reader.readCollection("ownedValsBytes", byte[].class);
+                ownedValsBytes = reader.readCollection("ownedValsBytes", Type.BYTE_ARR);
 
                 if (!reader.isLastRead())
                     return false;
@@ -353,7 +353,7 @@ public class GridNearTxPrepareResponse<K, V> extends GridDistributedTxPrepareRes
                 readState++;
 
             case 15:
-                pending = reader.readCollection("pending", GridCacheVersion.class);
+                pending = reader.readCollection("pending", Type.MSG);
 
                 if (!reader.isLastRead())
                     return false;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ca27b586/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryResponse.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryResponse.java
index 7fb4b4f..9b99a1f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryResponse.java
@@ -243,7 +243,7 @@ public class GridCacheQueryResponse<K, V> extends GridCacheMessage<K,
V> impleme
 
         switch (state.index()) {
             case 3:
-                if (!writer.writeCollection("dataBytes", dataBytes, byte[].class))
+                if (!writer.writeCollection("dataBytes", dataBytes, Type.BYTE_ARR))
                     return false;
 
                 state.increment();
@@ -267,7 +267,7 @@ public class GridCacheQueryResponse<K, V> extends GridCacheMessage<K,
V> impleme
                 state.increment();
 
             case 7:
-                if (!writer.writeCollection("metaDataBytes", metaDataBytes, byte[].class))
+                if (!writer.writeCollection("metaDataBytes", metaDataBytes, Type.BYTE_ARR))
                     return false;
 
                 state.increment();
@@ -293,7 +293,7 @@ public class GridCacheQueryResponse<K, V> extends GridCacheMessage<K,
V> impleme
 
         switch (readState) {
             case 3:
-                dataBytes = reader.readCollection("dataBytes", byte[].class);
+                dataBytes = reader.readCollection("dataBytes", Type.BYTE_ARR);
 
                 if (!reader.isLastRead())
                     return false;
@@ -325,7 +325,7 @@ public class GridCacheQueryResponse<K, V> extends GridCacheMessage<K,
V> impleme
                 readState++;
 
             case 7:
-                metaDataBytes = reader.readCollection("metaDataBytes", byte[].class);
+                metaDataBytes = reader.readCollection("metaDataBytes", Type.BYTE_ARR);
 
                 if (!reader.isLastRead())
                     return false;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ca27b586/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockDeltaSnapshotMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockDeltaSnapshotMessage.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockDeltaSnapshotMessage.java
index 7e23b8b..041ddc3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockDeltaSnapshotMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockDeltaSnapshotMessage.java
@@ -101,7 +101,7 @@ public class GridClockDeltaSnapshotMessage extends MessageAdapter {
 
         switch (state.index()) {
             case 0:
-                if (!writer.writeMap("deltas", deltas, UUID.class, long.class))
+                if (!writer.writeMap("deltas", deltas, Type.UUID, Type.LONG))
                     return false;
 
                 state.increment();
@@ -124,7 +124,7 @@ public class GridClockDeltaSnapshotMessage extends MessageAdapter {
 
         switch (readState) {
             case 0:
-                deltas = reader.readMap("deltas", UUID.class, long.class, false);
+                deltas = reader.readMap("deltas", Type.UUID, Type.LONG, false);
 
                 if (!reader.isLastRead())
                     return false;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ca27b586/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 7629324..2b4609e 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
@@ -273,7 +273,7 @@ public class GridDataLoadRequest extends MessageAdapter {
                 state.increment();
 
             case 6:
-                if (!writer.writeMap("ldrParticipants", ldrParticipants, UUID.class, IgniteUuid.class))
+                if (!writer.writeMap("ldrParticipants", ldrParticipants, Type.UUID, Type.IGNITE_UUID))
                     return false;
 
                 state.increment();
@@ -377,7 +377,7 @@ public class GridDataLoadRequest extends MessageAdapter {
                 readState++;
 
             case 6:
-                ldrParticipants = reader.readMap("ldrParticipants", UUID.class, IgniteUuid.class,
false);
+                ldrParticipants = reader.readMap("ldrParticipants", Type.UUID, Type.IGNITE_UUID,
false);
 
                 if (!reader.isLastRead())
                     return false;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ca27b586/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsBlocksMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsBlocksMessage.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsBlocksMessage.java
index adb1ca3..3f62995 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsBlocksMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsBlocksMessage.java
@@ -119,7 +119,7 @@ public class IgfsBlocksMessage extends IgfsCommunicationMessage {
 
         switch (state.index()) {
             case 0:
-                if (!writer.writeMap("blocks", blocks, IgfsBlockKey.class, byte[].class))
+                if (!writer.writeMap("blocks", blocks, Type.MSG, Type.BYTE_ARR))
                     return false;
 
                 state.increment();
@@ -151,7 +151,7 @@ public class IgfsBlocksMessage extends IgfsCommunicationMessage {
 
         switch (readState) {
             case 0:
-                blocks = reader.readMap("blocks", IgfsBlockKey.class, byte[].class, false);
+                blocks = reader.readMap("blocks", Type.MSG, Type.BYTE_ARR, false);
 
                 if (!reader.isLastRead())
                     return false;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ca27b586/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsFragmentizerRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsFragmentizerRequest.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsFragmentizerRequest.java
index 62e1375..bd309b8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsFragmentizerRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsFragmentizerRequest.java
@@ -119,7 +119,7 @@ public class IgfsFragmentizerRequest extends IgfsCommunicationMessage
{
                 state.increment();
 
             case 1:
-                if (!writer.writeCollection("fragmentRanges", fragmentRanges, IgfsFileAffinityRange.class))
+                if (!writer.writeCollection("fragmentRanges", fragmentRanges, Type.MSG))
                     return false;
 
                 state.increment();
@@ -147,7 +147,7 @@ public class IgfsFragmentizerRequest extends IgfsCommunicationMessage
{
                 readState++;
 
             case 1:
-                fragmentRanges = reader.readCollection("fragmentRanges", IgfsFileAffinityRange.class);
+                fragmentRanges = reader.readCollection("fragmentRanges", Type.MSG);
 
                 if (!reader.isLastRead())
                     return false;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ca27b586/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 7415523..c5cc326 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
@@ -208,7 +208,7 @@ public class GridStreamerExecutionRequest extends MessageAdapter {
                 state.increment();
 
             case 4:
-                if (!writer.writeMap("ldrParticipants", ldrParticipants, UUID.class, IgniteUuid.class))
+                if (!writer.writeMap("ldrParticipants", ldrParticipants, Type.UUID, Type.IGNITE_UUID))
                     return false;
 
                 state.increment();
@@ -273,7 +273,7 @@ public class GridStreamerExecutionRequest extends MessageAdapter {
                 readState++;
 
             case 4:
-                ldrParticipants = reader.readMap("ldrParticipants", UUID.class, IgniteUuid.class,
false);
+                ldrParticipants = reader.readMap("ldrParticipants", Type.UUID, Type.IGNITE_UUID,
false);
 
                 if (!reader.isLastRead())
                     return false;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ca27b586/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageAdapter.java
b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageAdapter.java
index 9cb8945..48c65fd 100644
--- a/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/plugin/extensions/communication/MessageAdapter.java
@@ -17,8 +17,11 @@
 
 package org.apache.ignite.plugin.extensions.communication;
 
+import org.apache.ignite.lang.*;
+
 import java.io.*;
 import java.nio.*;
+import java.util.*;
 
 /**
  * Base class for all communication messages.
@@ -88,46 +91,56 @@ public abstract class MessageAdapter implements Serializable, Cloneable
{
      * TODO
      */
     public enum Type {
-        BYTE,
+        BYTE(Byte.class),
+
+        SHORT(Short.class),
+
+        INT(Integer.class),
+
+        LONG(Long.class),
 
-        SHORT,
+        FLOAT(Float.class),
 
-        INT,
+        DOUBLE(Double.class),
 
-        LONG,
+        CHAR(Character.class),
 
-        FLOAT,
+        BOOLEAN(Boolean.class),
 
-        DOUBLE,
+        BYTE_ARR(byte[].class),
 
-        CHAR,
+        SHORT_ARR(short[].class),
 
-        BOOLEAN,
+        INT_ARR(int[].class),
 
-        BYTE_ARR,
+        LONG_ARR(long[].class),
 
-        SHORT_ARR,
+        FLOAT_ARR(float[].class),
 
-        INT_ARR,
+        DOUBLE_ARR(double[].class),
 
-        LONG_ARR,
+        CHAR_ARR(char[].class),
 
-        FLOAT_ARR,
+        BOOLEAN_ARR(boolean[].class),
 
-        DOUBLE_ARR,
+        STRING(String.class),
 
-        CHAR_ARR,
+        BIT_SET(BitSet.class),
 
-        BOOLEAN_ARR,
+        UUID(UUID.class),
 
-        STRING,
+        IGNITE_UUID(IgniteUuid.class),
 
-        BIT_SET,
+        MSG(MessageAdapter.class);
 
-        UUID,
+        private final Class<?> cls;
 
-        IGNITE_UUID,
+        private Type(Class<?> cls) {
+            this.cls = cls;
+        }
 
-        MSG
+        public Class<?> clazz() {
+            return cls;
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ca27b586/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 1e07ef3..415ea82 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
@@ -207,30 +207,31 @@ public interface MessageReader {
      * Reads array of objects.
      *
      * @param name Field name.
-     * @param itemCls Array component type.
+     * @param itemType Array component type.
      * @return Array of objects.
      */
-    public <T> T[] readObjectArray(String name, Class<T> itemCls);
+    public <T> T[] readObjectArray(String name, MessageAdapter.Type itemType);
 
     /**
      * Reads collection.
      *
      * @param name Field name.
-     * @param itemCls Collection item type.
+     * @param itemType Collection item type.
      * @return Collection.
      */
-    public <C extends Collection<T>, T> C readCollection(String name, Class<T>
itemCls);
+    public <C extends Collection<?>> C readCollection(String name, MessageAdapter.Type
itemType);
 
     /**
      * Reads map.
      *
      * @param name Field name.
-     * @param keyCls Map key type.
-     * @param valCls Map value type.
+     * @param keyType Map key type.
+     * @param valType Map value type.
      * @param linked Whether {@link LinkedHashMap} should be created.
      * @return Map.
      */
-    public <M extends Map<K, V>, K, V> M readMap(String name, Class<K>
keyCls, Class<V> valCls, boolean linked);
+    public <M extends Map<?, ?>> M readMap(String name, MessageAdapter.Type keyType,
MessageAdapter.Type valType,
+        boolean linked);
 
     /**
      * Tells whether last invocation of any of {@code readXXX(...)}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ca27b586/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 278b8e1..e6117a8 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
@@ -229,29 +229,30 @@ public interface MessageWriter {
      *
      * @param name Field name.
      * @param arr Array of objects.
-     * @param itemCls Array component type.
+     * @param itemType Array component type.
      * @return Whether array was fully written.
      */
-    public <T> boolean writeObjectArray(String name, T[] arr, Class<T> itemCls);
+    public <T> boolean writeObjectArray(String name, T[] arr, MessageAdapter.Type itemType);
 
     /**
      * Writes collection.
      *
      * @param name Field name.
      * @param col Collection.
-     * @param itemCls Collection item type.
+     * @param itemType Collection item type.
      * @return Whether value was fully written.
      */
-    public <T> boolean writeCollection(String name, Collection<T> col, Class<T>
itemCls);
+    public <T> boolean writeCollection(String name, Collection<T> col, MessageAdapter.Type
itemType);
 
     /**
      * Writes map.
      *
      * @param name Field name.
      * @param map Map.
-     * @param keyCls Map key type.
-     * @param valCls Map value type.
+     * @param keyType Map key type.
+     * @param valType Map value type.
      * @return Whether value was fully written.
      */
-    public <K, V> boolean writeMap(String name, Map<K, V> map, Class<K>
keyCls, Class<V> valCls);
+    public <K, V> boolean writeMap(String name, Map<K, V> map, MessageAdapter.Type
keyType,
+        MessageAdapter.Type valType);
 }


Mime
View raw message