asterixdb-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yingyi Bu (Code Review)" <do-not-re...@asterixdb.incubator.apache.org>
Subject Change in hyracks[master]: Override the reset method in ByteArrayAccessibleOutputStream.
Date Thu, 19 Nov 2015 01:02:51 GMT
Yingyi Bu has submitted this change and it was merged.

Change subject: Override the reset method in ByteArrayAccessibleOutputStream.
......................................................................


Override the reset method in ByteArrayAccessibleOutputStream.

Change-Id: Ib43f0b0fd9291b4a7e08963abb850d368ae2c288
Reviewed-on: https://asterix-gerrit.ics.uci.edu/500
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Till Westmann <tillw@apache.org>
---
M hyracks/hyracks-data/hyracks-data-std/src/main/java/org/apache/hyracks/data/std/util/ByteArrayAccessibleOutputStream.java
1 file changed, 10 insertions(+), 3 deletions(-)

Approvals:
  Till Westmann: Looks good to me, approved
  Jenkins: Verified



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 @@
         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 @@
      * 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 @@
      * 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

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/500
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib43f0b0fd9291b4a7e08963abb850d368ae2c288
Gerrit-PatchSet: 2
Gerrit-Project: hyracks
Gerrit-Branch: master
Gerrit-Owner: Yingyi Bu <buyingyi@gmail.com>
Gerrit-Reviewer: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Gerrit-Reviewer: Till Westmann <tillw@apache.org>
Gerrit-Reviewer: Yingyi Bu <buyingyi@gmail.com>
Gerrit-Reviewer: abdullah alamoudi <bamousaa@gmail.com>

Mime
View raw message