You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "Matt Corgan (JIRA)" <ji...@apache.org> on 2013/07/30 22:45:52 UTC

[jira] [Commented] (HBASE-9091) Update ByteRange to maintain consumer's position

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

Matt Corgan commented on HBASE-9091:
------------------------------------

I'm concerned that substantially changes the class from stateless to stateful, meaning it gets dangerous to share between threads or even between methods that don't agree on whether the position should be cleared before being passed in.  It's actually one of the biggest reasons i made this class to begin with, to remove ByteBuffer's position field (also to add equals/compareTo methods).

{code}Notably, it is mutable and an instance can be assigned over a byte[] after instantiation. {code}.  I agree it's mutable already, but maybe the comments or method names should emphasize that's only for Object reuse, not for performing normal logic.

Could we instead make a different class that does exactly what you need for the serialization use case?  ByteConsumer or something like that?
                
> Update ByteRange to maintain consumer's position
> ------------------------------------------------
>
>                 Key: HBASE-9091
>                 URL: https://issues.apache.org/jira/browse/HBASE-9091
>             Project: HBase
>          Issue Type: Sub-task
>          Components: Client
>            Reporter: Nick Dimiduk
>            Assignee: Nick Dimiduk
>             Fix For: 0.95.2
>
>
> ByteRange is a useful alternative to Java's ByteBuffer. Notably, it is mutable and an instance can be assigned over a byte[] after instantiation. This is valuable as a performance consideration when working with byte[] slices in a tight loop. Its current design is such that it is not possible to consume a portion of the range while performing activities like decoding an object without altering the definition of the range. It should provide a position that is independent from the range's offset and length to make partial reads easier.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira