Return-Path: X-Original-To: apmail-ignite-commits-archive@minotaur.apache.org Delivered-To: apmail-ignite-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6B7C618F00 for ; Wed, 18 Nov 2015 12:01:13 +0000 (UTC) Received: (qmail 29925 invoked by uid 500); 18 Nov 2015 12:01:13 -0000 Delivered-To: apmail-ignite-commits-archive@ignite.apache.org Received: (qmail 29832 invoked by uid 500); 18 Nov 2015 12:01:13 -0000 Mailing-List: contact commits-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.apache.org Delivered-To: mailing list commits@ignite.apache.org Received: (qmail 29665 invoked by uid 99); 18 Nov 2015 12:01:13 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 18 Nov 2015 12:01:13 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id C2F95E091D; Wed, 18 Nov 2015 12:01:12 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: vozerov@apache.org To: commits@ignite.apache.org Date: Wed, 18 Nov 2015 12:01:16 -0000 Message-Id: In-Reply-To: <8e4f22c5db9045af820f8277313ffec2@git.apache.org> References: <8e4f22c5db9045af820f8277313ffec2@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [5/6] ignite git commit: IGNITE-1917: Reader constructors simplification (2). 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 Authored: Tue Nov 17 15:09:47 2015 +0300 Committer: vozerov-gridgain 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 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 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(); }