You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by bu...@apache.org on 2015/11/19 02:06:12 UTC

incubator-asterixdb-hyracks git commit: Override the reset method in ByteArrayAccessibleOutputStream.

Repository: incubator-asterixdb-hyracks
Updated Branches:
  refs/heads/master feeb08b62 -> baec39a7e


Override the reset method in ByteArrayAccessibleOutputStream.

Change-Id: Ib43f0b0fd9291b4a7e08963abb850d368ae2c288
Reviewed-on: https://asterix-gerrit.ics.uci.edu/500
Tested-by: Jenkins <je...@fulliautomatix.ics.uci.edu>
Reviewed-by: Till Westmann <ti...@apache.org>


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

Branch: refs/heads/master
Commit: baec39a7ec19f4e7c39ecee1ed6a4d8dcbf136f3
Parents: feeb08b
Author: Yingyi Bu <bu...@gmail.com>
Authored: Tue Nov 17 22:34:41 2015 -0800
Committer: Yingyi Bu <bu...@gmail.com>
Committed: Wed Nov 18 17:02:51 2015 -0800

----------------------------------------------------------------------
 .../data/std/util/ByteArrayAccessibleOutputStream.java | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/baec39a7/hyracks/hyracks-data/hyracks-data-std/src/main/java/org/apache/hyracks/data/std/util/ByteArrayAccessibleOutputStream.java
----------------------------------------------------------------------
diff --git a/hyracks/hyracks-data/hyracks-data-std/src/main/java/org/apache/hyracks/data/std/util/ByteArrayAccessibleOutputStream.java b/hyracks/hyracks-data/hyracks-data-std/src/main/java/org/apache/hyracks/data/std/util/ByteArrayAccessibleOutputStream.java
index 287e2f2..7242340 100644
--- a/hyracks/hyracks-data/hyracks-data-std/src/main/java/org/apache/hyracks/data/std/util/ByteArrayAccessibleOutputStream.java
+++ b/hyracks/hyracks-data/hyracks-data-std/src/main/java/org/apache/hyracks/data/std/util/ByteArrayAccessibleOutputStream.java
@@ -35,6 +35,13 @@ public class ByteArrayAccessibleOutputStream extends ByteArrayOutputStream {
         return buf;
     }
 
+    // Override to make it not synchronized.
+    @Override
+    public void reset() {
+        count = 0;
+    }
+
+    @Override
     public void write(int b) {
         ensureCapacity(count + 1);
         buf[count] = (byte) b;
@@ -46,12 +53,11 @@ public class ByteArrayAccessibleOutputStream extends ByteArrayOutputStream {
      * This function is used to drop the already written delta bytes.
      * In some cases, we write some bytes, and afterward we found we've written more than expected.
      * Then we need to fix the position by rewind the current position to the expected one.
-     *
      * Currently, it is used by the {@link AbstractVarLenObjectBuilder} which may take more space than required
      * at beginning, and it will shift the data and fix the position whenever required.
-     *
      * It will throw {@link IndexOutOfBoundsException} if the {@code delta} is negative.
      * Evil function, use with caution.
+     *
      * @param delta
      */
     public void rewindPositionBy(int delta) {
@@ -81,7 +87,8 @@ public class ByteArrayAccessibleOutputStream extends ByteArrayOutputStream {
      * Increases the capacity to ensure that it can hold at least the
      * number of elements specified by the minimum capacity argument.
      *
-     * @param minCapacity the desired minimum capacity
+     * @param minCapacity
+     *            the desired minimum capacity
      */
     private void grow(int minCapacity) {
         // overflow-conscious code