ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agoncha...@apache.org
Subject [22/51] [abbrv] ignite git commit: IGNITE-1950: Binary format: fixed arrays - handles are not written/read for them any more.
Date Mon, 23 Nov 2015 06:39:37 GMT
IGNITE-1950: Binary format: fixed arrays - handles are not written/read for them any more.


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

Branch: refs/heads/ignite-1.5-tx-futs-opts
Commit: 3c745037c4e03c75ca6a98ec7f80888c02eb90ed
Parents: 60b805e
Author: vozerov-gridgain <vozerov@gridgain.com>
Authored: Fri Nov 20 11:08:26 2015 +0300
Committer: vozerov-gridgain <vozerov@gridgain.com>
Committed: Fri Nov 20 11:08:26 2015 +0300

----------------------------------------------------------------------
 .../internal/portable/BinaryReaderExImpl.java   | 86 ++------------------
 .../internal/portable/BinaryWriterExImpl.java   | 42 +---------
 .../portable/BinaryMarshallerSelfTest.java      | 12 ---
 3 files changed, 12 insertions(+), 128 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/3c745037/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryReaderExImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryReaderExImpl.java
b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryReaderExImpl.java
index 6ba5981..5e31532 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryReaderExImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryReaderExImpl.java
@@ -366,7 +366,7 @@ public class BinaryReaderExImpl implements BinaryReader, BinaryRawReaderEx,
Obje
      * @param obj Object.
      */
     void setHandler(Object obj) {
-        rCtx.put(start, obj);
+        setHandler(obj, start);
     }
 
     /**
@@ -1886,120 +1886,72 @@ public class BinaryReaderExImpl implements BinaryReader, BinaryRawReaderEx,
Obje
      * @return Value.
      */
     private byte[] doReadByteArray() {
-        int hPos = positionForHandle();
-
         int len = in.readInt();
 
-        byte[] arr = in.readByteArray(len);
-
-        setHandler(arr, hPos);
-
-        return arr;
+        return in.readByteArray(len);
     }
 
     /**
      * @return Value.
      */
     private short[] doReadShortArray() {
-        int hPos = positionForHandle();
-
         int len = in.readInt();
 
-        short[] arr = in.readShortArray(len);
-
-        setHandler(arr, hPos);
-
-        return arr;
+        return in.readShortArray(len);
     }
 
     /**
      * @return Value.
      */
     private int[] doReadIntArray() {
-        int hPos = positionForHandle();
-
         int len = in.readInt();
 
-        int[] arr = in.readIntArray(len);
-
-        setHandler(arr, hPos);
-
-        return arr;
+        return in.readIntArray(len);
     }
 
     /**
      * @return Value.
      */
     private long[] doReadLongArray() {
-        int hPos = positionForHandle();
-
         int len = in.readInt();
 
-        long[] arr = in.readLongArray(len);
-
-        setHandler(arr, hPos);
-
-        return arr;
+        return in.readLongArray(len);
     }
 
     /**
      * @return Value.
      */
     private float[] doReadFloatArray() {
-        int hPos = positionForHandle();
-
         int len = in.readInt();
 
-        float[] arr = in.readFloatArray(len);
-
-        setHandler(arr, hPos);
-
-        return arr;
+        return in.readFloatArray(len);
     }
 
     /**
      * @return Value.
      */
     private double[] doReadDoubleArray() {
-        int hPos = positionForHandle();
-
         int len = in.readInt();
 
-        double[] arr = in.readDoubleArray(len);
-
-        setHandler(arr, hPos);
-
-        return arr;
+        return in.readDoubleArray(len);
     }
 
     /**
      * @return Value.
      */
     private char[] doReadCharArray() {
-        int hPos = positionForHandle();
-
         int len = in.readInt();
 
-        char[] arr = in.readCharArray(len);
-
-        setHandler(arr, hPos);
-
-        return arr;
+        return in.readCharArray(len);
     }
 
     /**
      * @return Value.
      */
     private boolean[] doReadBooleanArray() {
-        int hPos = positionForHandle();
-
         int len = in.readInt();
 
-        boolean[] arr = in.readBooleanArray(len);
-
-        setHandler(arr, hPos);
-
-        return arr;
+        return in.readBooleanArray(len);
     }
 
     /**
@@ -2007,14 +1959,10 @@ public class BinaryReaderExImpl implements BinaryReader, BinaryRawReaderEx,
Obje
      * @throws BinaryObjectException In case of error.
      */
     private BigDecimal[] doReadDecimalArray() throws BinaryObjectException {
-        int hPos = positionForHandle();
-
         int len = in.readInt();
 
         BigDecimal[] arr = new BigDecimal[len];
 
-        setHandler(arr, hPos);
-
         for (int i = 0; i < len; i++) {
             byte flag = in.readByte();
 
@@ -2036,14 +1984,10 @@ public class BinaryReaderExImpl implements BinaryReader, BinaryRawReaderEx,
Obje
      * @throws BinaryObjectException In case of error.
      */
     private String[] doReadStringArray() throws BinaryObjectException {
-        int hPos = positionForHandle();
-
         int len = in.readInt();
 
         String[] arr = new String[len];
 
-        setHandler(arr, hPos);
-
         for (int i = 0; i < len; i++) {
             byte flag = in.readByte();
 
@@ -2065,14 +2009,10 @@ public class BinaryReaderExImpl implements BinaryReader, BinaryRawReaderEx,
Obje
      * @throws BinaryObjectException In case of error.
      */
     private UUID[] doReadUuidArray() throws BinaryObjectException {
-        int hPos = positionForHandle();
-
         int len = in.readInt();
 
         UUID[] arr = new UUID[len];
 
-        setHandler(arr, hPos);
-
         for (int i = 0; i < len; i++) {
             byte flag = in.readByte();
 
@@ -2094,14 +2034,10 @@ public class BinaryReaderExImpl implements BinaryReader, BinaryRawReaderEx,
Obje
      * @throws BinaryObjectException In case of error.
      */
     private Date[] doReadDateArray() throws BinaryObjectException {
-        int hPos = positionForHandle();
-
         int len = in.readInt();
 
         Date[] arr = new Date[len];
 
-        setHandler(arr, hPos);
-
         for (int i = 0; i < len; i++) {
             byte flag = in.readByte();
 
@@ -2123,14 +2059,10 @@ public class BinaryReaderExImpl implements BinaryReader, BinaryRawReaderEx,
Obje
      * @throws BinaryObjectException In case of error.
      */
     private Timestamp[] doReadTimestampArray() throws BinaryObjectException {
-        int hPos = positionForHandle();
-
         int len = in.readInt();
 
         Timestamp[] arr = new Timestamp[len];
 
-        setHandler(arr, hPos);
-
         for (int i = 0; i < len; i++) {
             byte flag = in.readByte();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/3c745037/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryWriterExImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryWriterExImpl.java
b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryWriterExImpl.java
index 7bb4c49..6f8534a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryWriterExImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryWriterExImpl.java
@@ -472,9 +472,6 @@ public class BinaryWriterExImpl implements BinaryWriter, BinaryRawWriterEx,
Obje
         if (val == null)
             out.writeByte(NULL);
         else {
-            if (tryWriteAsHandle(val))
-                return;
-
             out.unsafeEnsure(1 + 4);
             out.unsafeWriteByte(BYTE_ARR);
             out.unsafeWriteInt(val.length);
@@ -490,9 +487,6 @@ public class BinaryWriterExImpl implements BinaryWriter, BinaryRawWriterEx,
Obje
         if (val == null)
             out.writeByte(NULL);
         else {
-            if (tryWriteAsHandle(val))
-                return;
-
             out.unsafeEnsure(1 + 4);
             out.unsafeWriteByte(SHORT_ARR);
             out.unsafeWriteInt(val.length);
@@ -508,9 +502,6 @@ public class BinaryWriterExImpl implements BinaryWriter, BinaryRawWriterEx,
Obje
         if (val == null)
             out.writeByte(NULL);
         else {
-            if (tryWriteAsHandle(val))
-                return;
-
             out.unsafeEnsure(1 + 4);
             out.unsafeWriteByte(INT_ARR);
             out.unsafeWriteInt(val.length);
@@ -526,9 +517,6 @@ public class BinaryWriterExImpl implements BinaryWriter, BinaryRawWriterEx,
Obje
         if (val == null)
             out.writeByte(NULL);
         else {
-            if (tryWriteAsHandle(val))
-                return;
-
             out.unsafeEnsure(1 + 4);
             out.unsafeWriteByte(LONG_ARR);
             out.unsafeWriteInt(val.length);
@@ -544,9 +532,6 @@ public class BinaryWriterExImpl implements BinaryWriter, BinaryRawWriterEx,
Obje
         if (val == null)
             out.writeByte(NULL);
         else {
-            if (tryWriteAsHandle(val))
-                return;
-
             out.unsafeEnsure(1 + 4);
             out.unsafeWriteByte(FLOAT_ARR);
             out.unsafeWriteInt(val.length);
@@ -562,9 +547,6 @@ public class BinaryWriterExImpl implements BinaryWriter, BinaryRawWriterEx,
Obje
         if (val == null)
             out.writeByte(NULL);
         else {
-            if (tryWriteAsHandle(val))
-                return;
-
             out.unsafeEnsure(1 + 4);
             out.unsafeWriteByte(DOUBLE_ARR);
             out.unsafeWriteInt(val.length);
@@ -580,9 +562,6 @@ public class BinaryWriterExImpl implements BinaryWriter, BinaryRawWriterEx,
Obje
         if (val == null)
             out.writeByte(NULL);
         else {
-            if (tryWriteAsHandle(val))
-                return;
-
             out.unsafeEnsure(1 + 4);
             out.unsafeWriteByte(CHAR_ARR);
             out.unsafeWriteInt(val.length);
@@ -598,9 +577,6 @@ public class BinaryWriterExImpl implements BinaryWriter, BinaryRawWriterEx,
Obje
         if (val == null)
             out.writeByte(NULL);
         else {
-            if (tryWriteAsHandle(val))
-                return;
-
             out.unsafeEnsure(1 + 4);
             out.unsafeWriteByte(BOOLEAN_ARR);
             out.unsafeWriteInt(val.length);
@@ -616,9 +592,6 @@ public class BinaryWriterExImpl implements BinaryWriter, BinaryRawWriterEx,
Obje
         if (val == null)
             out.writeByte(NULL);
         else {
-            if (tryWriteAsHandle(val))
-                return;
-
             out.unsafeEnsure(1 + 4);
             out.unsafeWriteByte(DECIMAL_ARR);
             out.unsafeWriteInt(val.length);
@@ -635,9 +608,6 @@ public class BinaryWriterExImpl implements BinaryWriter, BinaryRawWriterEx,
Obje
         if (val == null)
             out.writeByte(NULL);
         else {
-            if (tryWriteAsHandle(val))
-                return;
-
             out.unsafeEnsure(1 + 4);
             out.unsafeWriteByte(STRING_ARR);
             out.unsafeWriteInt(val.length);
@@ -654,9 +624,6 @@ public class BinaryWriterExImpl implements BinaryWriter, BinaryRawWriterEx,
Obje
         if (val == null)
             out.writeByte(NULL);
         else {
-            if (tryWriteAsHandle(val))
-                return;
-
             out.unsafeEnsure(1 + 4);
             out.unsafeWriteByte(UUID_ARR);
             out.unsafeWriteInt(val.length);
@@ -673,9 +640,6 @@ public class BinaryWriterExImpl implements BinaryWriter, BinaryRawWriterEx,
Obje
         if (val == null)
             out.writeByte(NULL);
         else {
-            if (tryWriteAsHandle(val))
-                return;
-
             out.unsafeEnsure(1 + 4);
             out.unsafeWriteByte(DATE_ARR);
             out.unsafeWriteInt(val.length);
@@ -692,9 +656,6 @@ public class BinaryWriterExImpl implements BinaryWriter, BinaryRawWriterEx,
Obje
          if (val == null)
              out.writeByte(NULL);
          else {
-             if (tryWriteAsHandle(val))
-                 return;
-
              out.unsafeEnsure(1 + 4);
              out.unsafeWriteByte(TIMESTAMP_ARR);
              out.unsafeWriteInt(val.length);
@@ -1801,6 +1762,9 @@ public class BinaryWriterExImpl implements BinaryWriter, BinaryRawWriterEx,
Obje
             out.unsafeWriteByte(GridPortableMarshaller.HANDLE);
             out.unsafeWriteInt(pos - old);
 
+            if (obj.getClass().isArray())
+                System.out.println("CASE!");
+
             return true;
         }
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/3c745037/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryMarshallerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryMarshallerSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryMarshallerSelfTest.java
index 17ec7d6..dfc8109 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryMarshallerSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryMarshallerSelfTest.java
@@ -2258,19 +2258,7 @@ public class BinaryMarshallerSelfTest extends GridCommonAbstractTest
{
 
         assertEquals(obj, res);
 
-        assertTrue(res.bArr == res.inner.bArr);
-        assertTrue(res.cArr == res.inner.cArr);
-        assertTrue(res.boolArr == res.inner.boolArr);
-        assertTrue(res.sArr == res.inner.sArr);
-        assertTrue(res.strArr == res.inner.strArr);
-        assertTrue(res.iArr == res.inner.iArr);
-        assertTrue(res.lArr == res.inner.lArr);
-        assertTrue(res.fArr == res.inner.fArr);
-        assertTrue(res.dArr == res.inner.dArr);
-        assertTrue(res.dateArr == res.inner.dateArr);
-        assertTrue(res.uuidArr == res.inner.uuidArr);
         assertTrue(res.objArr == res.inner.objArr);
-        assertTrue(res.bdArr == res.inner.bdArr);
         assertTrue(res.map == res.inner.map);
         assertTrue(res.col == res.inner.col);
         assertTrue(res.mEntry == res.inner.mEntry);


Mime
View raw message