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

BELUGA BEHR commented on HBASE-19651:
-------------------------------------

@stack Actually, the only change in Guava is that LimitedInputStream was moved 
to a private class and ByteStream.limit simply instantiates it for you.  So in 
essence, HBase will still be using the LimitedInputStream:

https://github.com/google/guava/blob/fd919e54a55ba169dc7d9f54b7b3485aa7fa0970/guava/src/com/google/common/io/ByteStreams.java#L629

I think I blew away the tests, but all that needed to be tested is the overhead 
imposed by the implementation checking if the stream should be closed.

{code}
InputStream is = new ByteArrayInputStream(1024 * 1024 * 256); // 256MB
// InputStream lis = ByteStream.limit(is, 1024 * 1024 * 256);
// InputStream lis = new BoundedInputStream(is, 1024 * 1024 * 256);

byte[] buf = new byte[256]; // intentionally small buffer for lots of reads
while (-1 != lis.read(buf)); // time this action
{code}

> Remove LimitInputStream
> -----------------------
>
>                 Key: HBASE-19651
>                 URL: https://issues.apache.org/jira/browse/HBASE-19651
>             Project: HBase
>          Issue Type: Improvement
>          Components: hbase
>    Affects Versions: 3.0.0, 2.0.0-beta-2
>            Reporter: BELUGA BEHR
>            Assignee: BELUGA BEHR
>            Priority: Minor
>         Attachments: HBASE-19651.1.patch, HBASE-19651.2.patch, 
> HBASE-19651.3.patch, HBASE-19651.4.patch, HBASE-19651.5.patch, 
> HBASE-19651.6.patch
>
>
> Let us "drink our own champagne" and use the existing Apache Commons 
> BoundedInputStream instead.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to