ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject [3/4] ignite git commit: IGNITE-1917: Minor refactoring.
Date Mon, 16 Nov 2015 10:05:52 GMT
IGNITE-1917: Minor refactoring.


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

Branch: refs/heads/ignite-1917
Commit: 0b5fb1c6011e77608972be775a19c2ec7600642b
Parents: ccb7748
Author: vozerov-gridgain <vozerov@gridgain.com>
Authored: Mon Nov 16 12:46:36 2015 +0300
Committer: vozerov-gridgain <vozerov@gridgain.com>
Committed: Mon Nov 16 12:46:36 2015 +0300

----------------------------------------------------------------------
 .../internal/portable/BinaryWriterExImpl.java   | 42 ++++++--------------
 .../portable/GridPortableMarshaller.java        |  2 +-
 .../builder/BinaryObjectBuilderImpl.java        |  4 +-
 3 files changed, 17 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/0b5fb1c6/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 3e5f608..277bdb9 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
@@ -124,53 +124,37 @@ public class BinaryWriterExImpl implements BinaryWriter, BinaryRawWriterEx,
Obje
     /**
      * @param ctx Context.
      */
-    BinaryWriterExImpl(PortableContext ctx) {
+    public BinaryWriterExImpl(PortableContext ctx) {
         BinaryThreadLocalContext tlsCtx = BinaryThreadLocalContext.get();
 
         this.ctx = ctx;
         this.out = new PortableHeapOutputStream(INIT_CAP, tlsCtx.chunk());
+        this.schema = tlsCtx.schemaHolder();
 
         start = out.position();
-        schema = tlsCtx.schemaHolder();
-    }
-
-    /**
-     * @param ctx Context.
-     * @param typeId Type ID.
-     */
-    public BinaryWriterExImpl(PortableContext ctx, int typeId) {
-        this(ctx);
-
-        this.typeId = typeId;
     }
 
     /**
      * @param ctx Context.
      * @param out Output stream.
+     * @param handles Handles.
      */
-    BinaryWriterExImpl(PortableContext ctx, PortableOutputStream out) {
+    public BinaryWriterExImpl(PortableContext ctx, PortableOutputStream out, BinaryWriterSchemaHolder
schema,
+        BinaryWriterHandles handles) {
         this.ctx = ctx;
         this.out = out;
+        this.schema = schema;
+        this.handles = handles;
 
         start = out.position();
-
-        schema = BinaryThreadLocalContext.get().schemaHolder();
     }
 
-     /**
-      * @param ctx Context.
-      * @param out Output stream.
-      * @param handles Handles.
-      */
-     private BinaryWriterExImpl(PortableContext ctx, PortableOutputStream out, BinaryWriterSchemaHolder
schema,
-         BinaryWriterHandles handles) {
-         this.ctx = ctx;
-         this.out = out;
-         this.schema = schema;
-         this.handles = handles;
-
-         start = out.position();
-     }
+    /**
+     * @param typeId Type ID.
+     */
+    public void typeId(int typeId) {
+        this.typeId = typeId;
+    }
 
     /**
      * Close the writer releasing resources if necessary.

http://git-wip-us.apache.org/repos/asf/ignite/blob/0b5fb1c6/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 056a7c7..989f16d 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
@@ -295,7 +295,7 @@ public class GridPortableMarshaller {
      * @return Writer.
      */
     public BinaryWriterExImpl writer(PortableOutputStream out) {
-        return new BinaryWriterExImpl(ctx, out);
+        return new BinaryWriterExImpl(ctx, out, BinaryThreadLocalContext.get().schemaHolder(),
null);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/0b5fb1c6/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/BinaryObjectBuilderImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/BinaryObjectBuilderImpl.java
b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/BinaryObjectBuilderImpl.java
index 51eddcc..509bd6f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/BinaryObjectBuilderImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/builder/BinaryObjectBuilderImpl.java
@@ -178,7 +178,9 @@ public class BinaryObjectBuilderImpl implements BinaryObjectBuilder {
 
     /** {@inheritDoc} */
     @Override public BinaryObject build() {
-        try (BinaryWriterExImpl writer = new BinaryWriterExImpl(ctx, typeId)) {
+        try (BinaryWriterExImpl writer = new BinaryWriterExImpl(ctx)) {
+            writer.typeId(typeId);
+
             PortableBuilderSerializer serializationCtx = new PortableBuilderSerializer();
 
             serializationCtx.registerObjectWriting(this, 0);


Mime
View raw message