[
https://issues.apache.org/jira/browse/HBASE-8218?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13631702#comment-13631702
]
cuijianwei commented on HBASE-8218:
-----------------------------------
Thanks for your concern. I make a patch(HBASE-8218-0.94.3-v3.txt) from hbase
trunk. The main aim of lazily initializing the connection is that create
HConnection will throw IOException, if we initialize HConnection in
constructor, the current signature will change because current constructor
won't throw any exception: {code} public AggregationClient(Configuration cfg)
{code}. I agree that AggregationClient won't be used after invoking close(), so
that I change the logic of 'getConnection':
{code}
if (this.connection == null) {
synchronized (this) {
if (this.connection == null) {
{code}
The status of HConnection won't be checked, user will get an exception if they
continue using AggregationClient after close it. In this patch, I modify HTable
construction for 'max(...)' and corresponding unit test, if the logic seems
right, I will update other methods in AggregationClient.
> Pass HConnection and ExecutorService as parameters to methods of
> AggregationClient
> ----------------------------------------------------------------------------------
>
> Key: HBASE-8218
> URL: https://issues.apache.org/jira/browse/HBASE-8218
> Project: HBase
> Issue Type: Improvement
> Components: Client, Coprocessors
> Affects Versions: 0.94.3
> Reporter: cuijianwei
> Fix For: 0.98.0
>
> Attachments: HBASE-8218-0.94.3-v1.txt, HBASE-8218-0.94.3-v2.txt,
> HBASE-8218-0.94.3-v3.txt
>
>
> In AggregationClient, methods such as max(...), min(...) pass 'tableName' as
> a parameter, then a HTable will be created in the method, before the method
> return, the created HTable will be closed.
> The process above may be heavy because each call must create and close a
> HTable. The situation becomes worse when there is only one thread access
> HBase using AggregationClient. The underly HConnection of created HTable will
> also be created and then closed each time when we invoke these method because
> no other HTables using the HConnection. This operation is heavy. Therefore,
> can we add another group of methods which pass HTable or HTablePool as a
> parameter to methods defined in AggregationClient?
--
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