ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject [04/10] ignite git commit: IGNITE-1770: Minors.
Date Tue, 27 Oct 2015 09:00:59 GMT
IGNITE-1770: Minors.


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

Branch: refs/heads/ignite-1770
Commit: 6f71e02241ac5412365a0d64e0870138088d0613
Parents: 9e71ff0
Author: vozerov-gridgain <vozerov@gridgain.com>
Authored: Tue Oct 27 11:35:15 2015 +0300
Committer: vozerov-gridgain <vozerov@gridgain.com>
Committed: Tue Oct 27 11:35:15 2015 +0300

----------------------------------------------------------------------
 .../internal/portable/PortableReaderExImpl.java |  9 ++++-----
 .../ignite/internal/portable/PortableUtils.java | 20 ++++++++++++++++++++
 .../portable/builder/PortableBuilderImpl.java   | 11 ++++++-----
 3 files changed, 30 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/6f71e022/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableReaderExImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableReaderExImpl.java
b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableReaderExImpl.java
index 0b36d16..b6d36a1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableReaderExImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableReaderExImpl.java
@@ -24,6 +24,7 @@ import org.apache.ignite.internal.util.GridEnumCache;
 import org.apache.ignite.internal.util.lang.GridMapEntry;
 import org.apache.ignite.internal.util.typedef.internal.SB;
 import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgniteBiTuple;
 import org.apache.ignite.portable.PortableException;
 import org.apache.ignite.portable.PortableInvalidClassException;
 import org.apache.ignite.portable.PortableObject;
@@ -210,12 +211,10 @@ public class PortableReaderExImpl implements PortableReader, PortableRawReaderEx
 
         typeId = in.readIntPositioned(start + GridPortableMarshaller.TYPE_ID_POS);
 
-        footerStart = PortableUtils.footerStart(in, start);
-        footerEnd = PortableUtils.length(in, start);
+        IgniteBiTuple<Integer, Integer> footer = PortableUtils.footer(in, start);
 
-        // Take in count possible raw offset.
-        if ((((footerEnd - footerStart) >> 2) & 0x1) == 0x1)
-            footerEnd -= 4;
+        footerStart = footer.get1();
+        footerEnd = footer.get2();
 
         rawOff = PortableUtils.rawOffset(in, start);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/6f71e022/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java
b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java
index 4b53382..23ec501 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableUtils.java
@@ -18,7 +18,9 @@
 package org.apache.ignite.internal.portable;
 
 import org.apache.ignite.internal.portable.builder.PortableLazyValue;
+import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgniteBiTuple;
 import org.apache.ignite.portable.PortableException;
 import org.apache.ignite.portable.PortableObject;
 import org.jetbrains.annotations.Nullable;
@@ -566,6 +568,24 @@ public class PortableUtils {
     }
 
     /**
+     * Get object's footer.
+     *
+     * @param in Input stream.
+     * @param start Start position.
+     * @return Footer.
+     */
+    public static IgniteBiTuple<Integer, Integer> footer(PortablePositionReadable in,
int start) {
+        int footerStart = footerStart(in, start);
+        int footerEnd = length(in, start);
+
+        // Take in count possible raw offset.
+        if ((((footerEnd - footerStart) >> 2) & 0x1) == 0x1)
+            footerEnd -= 4;
+
+        return F.t(footerStart, footerEnd);
+    }
+
+    /**
      * Get footer start of the object.
      *
      * @param in Input stream.

http://git-wip-us.apache.org/repos/asf/ignite/blob/6f71e022/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderImpl.java
b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderImpl.java
index 4010415..0325641 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderImpl.java
@@ -26,6 +26,7 @@ import org.apache.ignite.internal.portable.PortableWriterExImpl;
 import org.apache.ignite.internal.processors.cache.portable.CacheObjectPortableProcessorImpl;
 import org.apache.ignite.internal.util.GridArgumentCheck;
 import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgniteBiTuple;
 import org.apache.ignite.portable.PortableBuilder;
 import org.apache.ignite.portable.PortableException;
 import org.apache.ignite.portable.PortableInvalidClassException;
@@ -394,12 +395,12 @@ public class PortableBuilderImpl implements PortableBuilder {
         if (readCache == null) {
             Map<Integer, Object> readCache = new HashMap<>();
 
-            int rawPos = start + PortableUtils.rawOffset(reader, start);
-            int footerPos = start + PortableUtils.footerStart(reader, start);
-            int footerEnd = start + PortableUtils.length(reader, start);
+            IgniteBiTuple<Integer, Integer> footer = PortableUtils.footer(reader, start);
+
+            int footerPos = footer.get1();
+            int footerEnd = footer.get2();
 
-            if ((((footerEnd - footerPos) >> 2) & 0x1) == 0x1)
-                footerEnd -= 4;
+            int rawPos = start + PortableUtils.rawOffset(reader, start);
 
             while (footerPos < footerEnd) {
                 int fieldId = reader.readIntPositioned(footerPos);


Mime
View raw message