hbase-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ramkrishna.s.vasudevan (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HBASE-16327) Unify BufferChain and MultiByteBuff
Date Thu, 04 Aug 2016 02:00:25 GMT

    [ https://issues.apache.org/jira/browse/HBASE-16327?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15406982#comment-15406982
] 

ramkrishna.s.vasudevan commented on HBASE-16327:
------------------------------------------------

True I agree but this was mainly to avoid similar classes but just with one added functionality.

{code}
assert items != null;
    assert items.length > 0;
    this.items = items;
    this.curItem = this.items[this.curItemIndex];
    // See below optimization in getInt(int) where we check whether the given index land in
current
    // item. For this we need to check whether the passed index is less than the next item
begin
    // offset. To handle this effectively for the last item buffer, we add an extra item into
this
    // array.
    itemBeginPos = new int[items.length + 1];
    int offset = 0;
    for (int i = 0; i < items.length; i++) {
      ByteBuffer item = items[i];
      item.rewind();
      itemBeginPos[i] = offset;
      int l = item.limit() - item.position();
      offset += l;
    }
    this.limit = offset;
    this.itemBeginPos[items.length] = offset + 1;
    this.limitedItemIndex = this.items.length - 1;
{code}
Is this constructor going to be so heavy? 

> Unify BufferChain and MultiByteBuff
> -----------------------------------
>
>                 Key: HBASE-16327
>                 URL: https://issues.apache.org/jira/browse/HBASE-16327
>             Project: HBase
>          Issue Type: Improvement
>            Reporter: ramkrishna.s.vasudevan
>            Assignee: ramkrishna.s.vasudevan
>            Priority: Minor
>
> Bufferchain is nothing but a collection of Bytebuffers. We already have MultiBytebuff.
May be we can unify both and add the Bufferchain#write() to ByteBuff abstract class. 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message