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

Ted Yu commented on HBASE-4752:
-------------------------------

Here are some statistics about how widely HBase codebase uses class(es) from 
Guava:
{code}
zhihyu$ find src/main -name '*.java' -exec grep Precondition {} \; -print | head
import com.google.common.base.Preconditions;
    Preconditions.checkArgument(n >= 0, "limit be positive %s", n);
    Preconditions.checkArgument(filterArguments.size() == 1,
src/main/java/org/apache/hadoop/hbase/filter/ColumnCountGetFilter.java
import com.google.common.base.Preconditions;
    Preconditions.checkArgument(limit >= 0, "limit must be positive %s", limit);
    Preconditions.checkArgument(offset >= 0, "offset must be positive %s", 
offset);
    Preconditions.checkArgument(filterArguments.size() == 2,
src/main/java/org/apache/hadoop/hbase/filter/ColumnPaginationFilter.java
import com.google.common.base.Preconditions;

zhihyu$ find src/main -name '*.java' -exec grep Precondition {} \; | wc
      96     270    5149
{code}
If usage of Preconditions is recommended, we shouldn't worry about using 
MinMaxPriorityQueue which already appears in our codebase.

I am also open to finding other implementations for double-ended queue.
                
> Don't create an unnecessary LinkedList when evicting from the BlockCache
> ------------------------------------------------------------------------
>
>                 Key: HBASE-4752
>                 URL: https://issues.apache.org/jira/browse/HBASE-4752
>             Project: HBase
>          Issue Type: Improvement
>          Components: performance, regionserver
>    Affects Versions: 0.90.4
>            Reporter: Benoit Sigoure
>            Assignee: Ted Yu
>            Priority: Minor
>             Fix For: 0.94.0
>
>         Attachments: 
> 0001-HBASE-4752-Don-t-create-an-unnecessary-LinkedList-wh.patch, 
> 4752-trunk-v2.txt, 4752-trunk.txt
>
>
> When evicting from the BlockCache, the code creates a LinkedList containing 
> every single block sorted by access time.  This list is created from a 
> PriorityQueue.  I don't believe it is necessary, as the PriorityQueue can be 
> used directly.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to