IGNITE-1917: Reader constructors simplification (2).

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

Branch: refs/heads/ignite-1917
Commit: d4071a2b14a14c58d78df4dfebaf95bb70e3f923
Parents: ee88850
Author: vozerov-gridgain <voze...@gridgain.com>
Authored: Tue Nov 17 15:09:47 2015 +0300
Committer: vozerov-gridgain <voze...@gridgain.com>
Committed: Tue Nov 17 15:09:47 2015 +0300

----------------------------------------------------------------------
 .../internal/portable/BinaryObjectImpl.java      |  2 +-
 .../portable/BinaryObjectOffheapImpl.java        | 10 ++++------
 .../internal/portable/BinaryReaderExImpl.java    | 19 +++++--------------
 .../portable/GridPortableMarshaller.java         |  8 +++++---
 .../portable/builder/PortableBuilderReader.java  |  7 +++++--
 5 files changed, 20 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/d4071a2b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectImpl.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectImpl.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectImpl.java
index 7455c70..fabbdca 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectImpl.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectImpl.java
@@ -583,6 +583,6 @@ public final class BinaryObjectImpl extends BinaryObjectEx 
implements Externaliz
      * @return Reader.
      */
     private BinaryReaderExImpl newReader() {
-        return new BinaryReaderExImpl(ctx, new PortableHeapInputStream(arr), 
start, null);
+        return new BinaryReaderExImpl(ctx, new PortableHeapInputStream(arr), 
start, null, new BinaryReaderHandles());
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/d4071a2b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectOffheapImpl.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectOffheapImpl.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectOffheapImpl.java
index 66cbf20..91c68cd 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectOffheapImpl.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryObjectOffheapImpl.java
@@ -324,11 +324,8 @@ public class BinaryObjectOffheapImpl extends 
BinaryObjectEx implements Externali
     /** {@inheritDoc} */
     @SuppressWarnings("unchecked")
     @Nullable @Override protected <F> F field(BinaryReaderHandles rCtx, String 
fieldName) {
-        BinaryReaderExImpl reader = new BinaryReaderExImpl(ctx,
-            new PortableOffheapInputStream(ptr, size, false),
-            start,
-            null,
-            rCtx);
+        BinaryReaderExImpl reader =
+            new BinaryReaderExImpl(ctx, new PortableOffheapInputStream(ptr, 
size, false), start, null, rCtx);
 
         return (F)reader.unmarshalField(fieldName);
     }
@@ -430,6 +427,7 @@ public class BinaryObjectOffheapImpl extends BinaryObjectEx 
implements Externali
      * @return Reader.
      */
     private BinaryReaderExImpl newReader() {
-        return new BinaryReaderExImpl(ctx, new PortableOffheapInputStream(ptr, 
size, false), start, null);
+        return new BinaryReaderExImpl(ctx, new PortableOffheapInputStream(ptr, 
size, false), start, null,
+            new BinaryReaderHandles());
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/d4071a2b/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 7cffe28..60ec1ca 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
@@ -126,14 +126,14 @@ public class BinaryReaderExImpl implements BinaryReader, 
BinaryRawReaderEx, Obje
     private final ClassLoader ldr;
 
     /** */
-    private int start;
-
-    /** */
     private BinaryReaderHandles rCtx;
 
     /** */
     private PortableClassDescriptor desc;
 
+    /** */
+    private int start;
+
     /** Flag indicating that object header was parsed. */
     private boolean hdrParsed;
 
@@ -174,18 +174,9 @@ public class BinaryReaderExImpl implements BinaryReader, 
BinaryRawReaderEx, Obje
      * @param ctx Context.
      * @param in Input stream.
      * @param start Start.
-     */
-    public BinaryReaderExImpl(PortableContext ctx, PortableInputStream in, int 
start, ClassLoader ldr) {
-        this(ctx, in, start, ldr, new BinaryReaderHandles());
-    }
-
-    /**
-     * @param ctx Context.
-     * @param in Input stream.
-     * @param start Start.
      * @param rCtx Context.
      */
-    BinaryReaderExImpl(PortableContext ctx, PortableInputStream in, int start, 
ClassLoader ldr,
+    public BinaryReaderExImpl(PortableContext ctx, PortableInputStream in, int 
start, ClassLoader ldr,
         BinaryReaderHandles rCtx) {
         this.ctx = ctx;
         this.in = in;
@@ -1780,7 +1771,7 @@ public class BinaryReaderExImpl implements BinaryReader, 
BinaryRawReaderEx, Obje
 
     /**
      * @return Deserialized object.
-     * @throws org.apache.ignite.binary.BinaryObjectException If failed.
+     * @throws BinaryObjectException If failed.
      */
     @Nullable Object deserialize() throws BinaryObjectException {
         Object obj;

http://git-wip-us.apache.org/repos/asf/ignite/blob/d4071a2b/modules/core/src/main/java/org/apache/ignite/internal/portable/GridPortableMarshaller.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/portable/GridPortableMarshaller.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/portable/GridPortableMarshaller.java
index 36c76c4..dbf4a8b 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/portable/GridPortableMarshaller.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/portable/GridPortableMarshaller.java
@@ -255,7 +255,8 @@ public class GridPortableMarshaller {
     @Nullable public <T> T unmarshal(byte[] bytes, @Nullable ClassLoader 
clsLdr) throws BinaryObjectException {
         assert bytes != null;
 
-        BinaryReaderExImpl reader = new BinaryReaderExImpl(ctx, new 
PortableHeapInputStream(bytes), 0, clsLdr);
+        BinaryReaderExImpl reader =
+            new BinaryReaderExImpl(ctx, new PortableHeapInputStream(bytes), 0, 
clsLdr, new BinaryReaderHandles());
 
         return (T)reader.unmarshal();
     }
@@ -284,7 +285,8 @@ public class GridPortableMarshaller {
         if (arr[0] == NULL)
             return null;
 
-        BinaryReaderExImpl reader = new BinaryReaderExImpl(ctx, new 
PortableHeapInputStream(arr), 0, ldr);
+        BinaryReaderExImpl reader =
+            new BinaryReaderExImpl(ctx, new PortableHeapInputStream(arr), 0, 
ldr, new BinaryReaderHandles());
 
         return (T)reader.deserialize();
     }
@@ -307,7 +309,7 @@ public class GridPortableMarshaller {
      */
     public BinaryReaderExImpl reader(PortableInputStream in) {
         // TODO: IGNITE-1272 - Is class loader needed here?
-        return new BinaryReaderExImpl(ctx, in, in.position(), null);
+        return new BinaryReaderExImpl(ctx, in, in.position(), null, new 
BinaryReaderHandles());
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/d4071a2b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderReader.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderReader.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderReader.java
index fae9417..a9ec65a 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderReader.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/PortableBuilderReader.java
@@ -21,6 +21,8 @@ import java.sql.Timestamp;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.Map;
+
+import org.apache.ignite.internal.portable.BinaryReaderHandles;
 import org.apache.ignite.internal.portable.GridPortableMarshaller;
 import org.apache.ignite.internal.portable.PortableContext;
 import org.apache.ignite.internal.portable.PortablePositionReadable;
@@ -65,7 +67,7 @@ public class PortableBuilderReader implements 
PortablePositionReadable {
         pos = objImpl.start();
 
         // TODO: IGNITE-1272 - Is class loader needed here?
-        reader = new BinaryReaderExImpl(ctx, new PortableHeapInputStream(arr), 
pos, null);
+        reader = new BinaryReaderExImpl(ctx, new PortableHeapInputStream(arr), 
pos, null, new BinaryReaderHandles());
     }
 
     /**
@@ -95,7 +97,8 @@ public class PortableBuilderReader implements 
PortablePositionReadable {
         if (start == pos)
             targetReader = reader;
         else
-            targetReader = new BinaryReaderExImpl(ctx, new 
PortableHeapInputStream(arr), start, null);
+            targetReader =
+                new BinaryReaderExImpl(ctx, new PortableHeapInputStream(arr), 
start, null, new BinaryReaderHandles());
 
         return targetReader.getOrCreateSchema();
     }

Reply via email to