ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject [08/12] ignite git commit: IGNITE-1282: Minor refactoring.
Date Mon, 16 Nov 2015 08:51:07 GMT
IGNITE-1282: Minor refactoring.


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

Branch: refs/heads/ignite-1917
Commit: 3edc0ededf8a7dfdf34a79f76f07f63fb0a4156f
Parents: 0fa8992
Author: vozerov-gridgain <vozerov@gridgain.com>
Authored: Mon Nov 16 10:23:51 2015 +0300
Committer: vozerov-gridgain <vozerov@gridgain.com>
Committed: Mon Nov 16 10:23:51 2015 +0300

----------------------------------------------------------------------
 .../internal/portable/BinaryWriterExImpl.java   | 36 ++++++--------------
 1 file changed, 11 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/3edc0ede/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 ffa89b0..74f8bee 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
@@ -304,26 +304,6 @@ public class BinaryWriterExImpl implements BinaryWriter, BinaryRawWriterEx,
Obje
     }
 
     /**
-     * @param obj Object.
-     * @return Handle.
-     */
-    int handle(Object obj) {
-        assert obj != null;
-
-        int pos = out.position();
-
-        Integer old = handles.put(obj, pos);
-
-        if (old == null)
-            return -1;
-        else {
-            handles.put(obj, old);
-
-            return pos - old;
-        }
-    }
-
-    /**
      * @return Array.
      */
     public byte[] array() {
@@ -1827,16 +1807,22 @@ public class BinaryWriterExImpl implements BinaryWriter, BinaryRawWriterEx,
Obje
      * @return {@code true} if the object has been written as a handle.
      */
     boolean tryWriteAsHandle(Object obj) {
-        int handle = handle(obj);
+        assert obj != null;
+
+        int pos = out.position();
+
+        Integer old = handles.put(obj, pos);
+
+        if (old == null)
+            return false;
+        else {
+            handles.put(obj, old);
 
-        if (handle >= 0) {
             doWriteByte(GridPortableMarshaller.HANDLE);
-            doWriteInt(handle);
+            doWriteInt(pos - old);
 
             return true;
         }
-
-        return false;
     }
 
     /**


Mime
View raw message