ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vkuliche...@apache.org
Subject [17/50] [abbrv] incubator-ignite git commit: ignite-nio - Removing message clone
Date Sun, 15 Feb 2015 08:41:59 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/dcb4c709
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/dcb4c709
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/dcb4c709

Branch: refs/heads/sprint-1
Commit: dcb4c70930787b74a0aa421982f3fac717e73ebc
Parents: f9f06c0
Author: Valentin Kulichenko <vkulichenko@gridgain.com>
Authored: Sat Feb 14 19:45:14 2015 -0800
Committer: Valentin Kulichenko <vkulichenko@gridgain.com>
Committed: Sat Feb 14 19:45:14 2015 -0800

----------------------------------------------------------------------
 .../CommunicationMessageCodeGenerator.java      |  8 ++-
 .../internal/direct/DirectByteBufferStream.java |  5 +-
 .../internal/direct/DirectMessageReader.java    |  4 +-
 .../distributed/GridDistributedLockRequest.java |  2 +-
 .../dht/atomic/GridDhtAtomicUpdateRequest.java  |  2 +-
 .../dht/atomic/GridNearAtomicUpdateRequest.java |  4 +-
 .../distributed/near/GridNearLockRequest.java   |  4 +-
 .../distributed/near/GridNearLockResponse.java  |  4 +-
 .../communication/MessageAdapter.java           | 55 ++++++++------------
 .../extensions/communication/MessageReader.java |  3 +-
 10 files changed, 42 insertions(+), 49 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dcb4c709/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 7ce89a7..a9846d1 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
@@ -674,8 +674,12 @@ public class CommunicationMessageCodeGenerator {
         }
         else if (BASE_CLS.isAssignableFrom(type))
             returnFalseIfReadFailed(name, "reader.readMessage", field);
-        else if (type.isArray())
-            returnFalseIfReadFailed(name, "reader.readObjectArray", field, "Type." + typeEnum(type.getComponentType()));
+        else if (type.isArray()) {
+            Class<?> compType = type.getComponentType();
+
+            returnFalseIfReadFailed(name, "reader.readObjectArray", field, "Type." + typeEnum(compType),
+                compType.getSimpleName() + ".class");
+        }
         else if (Collection.class.isAssignableFrom(type) && !Set.class.isAssignableFrom(type))
{
             assert colItemType != null;
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dcb4c709/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 f503223..fed6a53 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
@@ -967,10 +967,11 @@ public class DirectByteBufferStream {
 
     /**
      * @param itemType Component type.
+     * @param itemCls Component class.
      * @return Array.
      */
     @SuppressWarnings("unchecked")
-    public <T> T[] readObjectArray(MessageAdapter.Type itemType) {
+    public <T> T[] readObjectArray(MessageAdapter.Type itemType, Class<T> itemCls)
{
         if (readSize == -1) {
             int size = readInt();
 
@@ -982,7 +983,7 @@ public class DirectByteBufferStream {
 
         if (readSize >= 0) {
             if (objArr == null)
-                objArr = (Object[])Array.newInstance(itemType.clazz(), readSize);
+                objArr = (Object[])Array.newInstance(itemCls, readSize);
 
             for (int i = readItems; i < readSize; i++) {
                 Object item = read(itemType);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dcb4c709/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 191c522..f52a4c8 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
@@ -236,8 +236,8 @@ public class DirectMessageReader implements MessageReader {
     }
 
     /** {@inheritDoc} */
-    @Override public <T> T[] readObjectArray(String name, MessageAdapter.Type itemType)
{
-        T[] msg = stream.readObjectArray(itemType);
+    @Override public <T> T[] readObjectArray(String name, MessageAdapter.Type itemType,
Class<T> itemCls) {
+        T[] msg = stream.readObjectArray(itemType, itemCls);
 
         lastRead = stream.lastFinished();
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dcb4c709/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 832c6fd..c39f571 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
@@ -589,7 +589,7 @@ public class GridDistributedLockRequest<K, V> extends GridDistributedBaseMessage
 
         switch (readState) {
             case 8:
-                drVersByIdx = reader.readObjectArray("drVersByIdx", Type.MSG);
+                drVersByIdx = reader.readObjectArray("drVersByIdx", Type.MSG, GridCacheVersion.class);
 
                 if (!reader.isLastRead())
                     return false;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dcb4c709/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 df1ed45..a6caa5a 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
@@ -914,7 +914,7 @@ public class GridDhtAtomicUpdateRequest<K, V> extends GridCacheMessage<K,
V> imp
                 readState++;
 
             case 8:
-                invokeArgsBytes = reader.readObjectArray("invokeArgsBytes", Type.BYTE_ARR);
+                invokeArgsBytes = reader.readObjectArray("invokeArgsBytes", Type.BYTE_ARR,
byte[].class);
 
                 if (!reader.isLastRead())
                     return false;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dcb4c709/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 6600b76..5103919 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
@@ -768,7 +768,7 @@ public class GridNearAtomicUpdateRequest<K, V> extends GridCacheMessage<K,
V> im
                 readState++;
 
             case 8:
-                filterBytes = reader.readObjectArray("filterBytes", Type.BYTE_ARR);
+                filterBytes = reader.readObjectArray("filterBytes", Type.BYTE_ARR, byte[].class);
 
                 if (!reader.isLastRead())
                     return false;
@@ -800,7 +800,7 @@ public class GridNearAtomicUpdateRequest<K, V> extends GridCacheMessage<K,
V> im
                 readState++;
 
             case 12:
-                invokeArgsBytes = reader.readObjectArray("invokeArgsBytes", Type.BYTE_ARR);
+                invokeArgsBytes = reader.readObjectArray("invokeArgsBytes", Type.BYTE_ARR,
byte[].class);
 
                 if (!reader.isLastRead())
                     return false;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dcb4c709/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockRequest.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockRequest.java
index 58054c1..3e30f4d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockRequest.java
@@ -470,7 +470,7 @@ public class GridNearLockRequest<K, V> extends GridDistributedLockRequest<K,
V>
                 readState++;
 
             case 25:
-                dhtVers = reader.readObjectArray("dhtVers", Type.MSG);
+                dhtVers = reader.readObjectArray("dhtVers", Type.MSG, GridCacheVersion.class);
 
                 if (!reader.isLastRead())
                     return false;
@@ -478,7 +478,7 @@ public class GridNearLockRequest<K, V> extends GridDistributedLockRequest<K,
V>
                 readState++;
 
             case 26:
-                filterBytes = reader.readObjectArray("filterBytes", Type.BYTE_ARR);
+                filterBytes = reader.readObjectArray("filterBytes", Type.BYTE_ARR, byte[].class);
 
                 if (!reader.isLastRead())
                     return false;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dcb4c709/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockResponse.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockResponse.java
index 0587f06..e74f4eb 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockResponse.java
@@ -262,7 +262,7 @@ public class GridNearLockResponse<K, V> extends GridDistributedLockResponse<K,
V
 
         switch (readState) {
             case 11:
-                dhtVers = reader.readObjectArray("dhtVers", Type.MSG);
+                dhtVers = reader.readObjectArray("dhtVers", Type.MSG, GridCacheVersion.class);
 
                 if (!reader.isLastRead())
                     return false;
@@ -278,7 +278,7 @@ public class GridNearLockResponse<K, V> extends GridDistributedLockResponse<K,
V
                 readState++;
 
             case 13:
-                mappedVers = reader.readObjectArray("mappedVers", Type.MSG);
+                mappedVers = reader.readObjectArray("mappedVers", Type.MSG, GridCacheVersion.class);
 
                 if (!reader.isLastRead())
                     return false;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dcb4c709/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 48c65fd..9cb8945 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,11 +17,8 @@
 
 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.
@@ -91,56 +88,46 @@ public abstract class MessageAdapter implements Serializable, Cloneable
{
      * TODO
      */
     public enum Type {
-        BYTE(Byte.class),
-
-        SHORT(Short.class),
-
-        INT(Integer.class),
-
-        LONG(Long.class),
+        BYTE,
 
-        FLOAT(Float.class),
+        SHORT,
 
-        DOUBLE(Double.class),
+        INT,
 
-        CHAR(Character.class),
+        LONG,
 
-        BOOLEAN(Boolean.class),
+        FLOAT,
 
-        BYTE_ARR(byte[].class),
+        DOUBLE,
 
-        SHORT_ARR(short[].class),
+        CHAR,
 
-        INT_ARR(int[].class),
+        BOOLEAN,
 
-        LONG_ARR(long[].class),
+        BYTE_ARR,
 
-        FLOAT_ARR(float[].class),
+        SHORT_ARR,
 
-        DOUBLE_ARR(double[].class),
+        INT_ARR,
 
-        CHAR_ARR(char[].class),
+        LONG_ARR,
 
-        BOOLEAN_ARR(boolean[].class),
+        FLOAT_ARR,
 
-        STRING(String.class),
+        DOUBLE_ARR,
 
-        BIT_SET(BitSet.class),
+        CHAR_ARR,
 
-        UUID(UUID.class),
+        BOOLEAN_ARR,
 
-        IGNITE_UUID(IgniteUuid.class),
+        STRING,
 
-        MSG(MessageAdapter.class);
+        BIT_SET,
 
-        private final Class<?> cls;
+        UUID,
 
-        private Type(Class<?> cls) {
-            this.cls = cls;
-        }
+        IGNITE_UUID,
 
-        public Class<?> clazz() {
-            return cls;
-        }
+        MSG
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dcb4c709/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 415ea82..9fa122d 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
@@ -208,9 +208,10 @@ public interface MessageReader {
      *
      * @param name Field name.
      * @param itemType Array component type.
+     * @param itemCls Array component class.
      * @return Array of objects.
      */
-    public <T> T[] readObjectArray(String name, MessageAdapter.Type itemType);
+    public <T> T[] readObjectArray(String name, MessageAdapter.Type itemType, Class<T>
itemCls);
 
     /**
      * Reads collection.


Mime
View raw message