IGNITE-471 - Marshalling fixes

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

Branch: refs/heads/ignite-471
Commit: e574923e306b743bb2bda949c392a69e68f09bf6
Parents: aca1d3c
Author: Valentin Kulichenko <[email protected]>
Authored: Thu Mar 12 17:24:42 2015 -0700
Committer: Valentin Kulichenko <[email protected]>
Committed: Thu Mar 12 17:24:42 2015 -0700

----------------------------------------------------------------------
 .../internal/util/io/GridUnsafeDataOutput.java  | 21 --------------------
 .../optimized/OptimizedMarshaller.java          |  3 ++-
 2 files changed, 2 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e574923e/modules/core/src/main/java/org/apache/ignite/internal/util/io/GridUnsafeDataOutput.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/util/io/GridUnsafeDataOutput.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/util/io/GridUnsafeDataOutput.java
index e299f9e..68451f8 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/util/io/GridUnsafeDataOutput.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/util/io/GridUnsafeDataOutput.java
@@ -71,9 +71,6 @@ public class GridUnsafeDataOutput extends OutputStream 
implements GridDataOutput
     /** Underlying output stream. */
     private OutputStream out;
 
-    /** Maximum message size. */
-    private int maxOff;
-
     /** Last length check timestamp. */
     private long lastCheck = U.currentTimeMillis();
 
@@ -139,10 +136,6 @@ public class GridUnsafeDataOutput extends OutputStream 
implements GridDataOutput
     private void requestFreeSize(int size) {
         size = off + size;
 
-        maxOff = Math.max(maxOff, size);
-
-        long now = U.currentTimeMillis();
-
         if (size > bytes.length) {
             byte[] newBytes = new byte[size << 1]; // Grow.
 
@@ -150,20 +143,6 @@ public class GridUnsafeDataOutput extends OutputStream 
implements GridDataOutput
 
             bytes = newBytes;
         }
-        else if (now - lastCheck > CHECK_FREQ) {
-            int halfSize = bytes.length >> 1;
-
-            if (maxOff < halfSize) {
-                byte[] newBytes = new byte[halfSize]; // Shrink.
-
-                UNSAFE.copyMemory(bytes, byteArrOff, newBytes, byteArrOff, 
off);
-
-                bytes = newBytes;
-            }
-
-            maxOff = 0;
-            lastCheck = now;
-        }
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e574923e/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedMarshaller.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedMarshaller.java
 
b/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedMarshaller.java
index 8eaf23b..9c788e2 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedMarshaller.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/OptimizedMarshaller.java
@@ -77,7 +77,8 @@ import java.nio.*;
  */
 public class OptimizedMarshaller extends AbstractMarshaller {
     /** Initial buffer size. */
-    private static final int INIT_BUF_SIZE = 4 * 1024;
+    // TODO: IGNITE-471 - Make configurable
+    private static final int INIT_BUF_SIZE = 256;
 
     /** Default class loader. */
     private final ClassLoader dfltClsLdr = getClass().getClassLoader();

Reply via email to