You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vo...@apache.org on 2015/11/16 09:51:07 UTC

[08/12] ignite git commit: IGNITE-1282: Minor refactoring.

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 <vo...@gridgain.com>
Authored: Mon Nov 16 10:23:51 2015 +0300
Committer: vozerov-gridgain <vo...@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;
     }
 
     /**