hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ramkris...@apache.org
Subject hbase git commit: HBASE-12845 - ByteBufferOutputStream should grow as direct buffer if the initial buffer is also direct BB (Ram)
Date Thu, 15 Jan 2015 07:33:34 GMT
Repository: hbase
Updated Branches:
  refs/heads/0.98 332eff828 -> cca511752


HBASE-12845 - ByteBufferOutputStream should grow as direct buffer if the
initial buffer is also direct BB (Ram)


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

Branch: refs/heads/0.98
Commit: cca511752cbe5afaac0e902b34cbbafd0819907c
Parents: 332eff8
Author: Ramkrishna <ramkrishna.s.vasudevan@intel.com>
Authored: Thu Jan 15 13:02:58 2015 +0530
Committer: Ramkrishna <ramkrishna.s.vasudevan@intel.com>
Committed: Thu Jan 15 13:02:58 2015 +0530

----------------------------------------------------------------------
 .../org/apache/hadoop/hbase/io/ByteBufferOutputStream.java   | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/cca51175/hbase-common/src/main/java/org/apache/hadoop/hbase/io/ByteBufferOutputStream.java
----------------------------------------------------------------------
diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/io/ByteBufferOutputStream.java
b/hbase-common/src/main/java/org/apache/hadoop/hbase/io/ByteBufferOutputStream.java
index 55a4aac..257b850 100644
--- a/hbase-common/src/main/java/org/apache/hadoop/hbase/io/ByteBufferOutputStream.java
+++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/io/ByteBufferOutputStream.java
@@ -70,8 +70,12 @@ public class ByteBufferOutputStream extends OutputStream {
       int newSize = (int)Math.min((((long)buf.capacity()) * 2),
           (long)(Integer.MAX_VALUE));
       newSize = Math.max(newSize, buf.position() + extra);
-
-      ByteBuffer newBuf = ByteBuffer.allocate(newSize);
+      ByteBuffer newBuf = null;
+      if (buf.isDirect()) {
+        newBuf = ByteBuffer.allocateDirect(newSize);
+      } else {
+        newBuf = ByteBuffer.allocate(newSize);
+      }
       buf.flip();
       newBuf.put(buf);
       buf = newBuf;


Mime
View raw message