[
https://issues.apache.org/jira/browse/HBASE-1655?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Ken Weiner updated HBASE-1655:
------------------------------
Status: Patch Available (was: In Progress)
I've submitted another patch, HBASE-1655-v3.patch, that reflects a different
approach taken to improve HTablePool. In the new approach, there will be no
static methods at all. Instead, the normal usage of the class will be to
instantiate an HTablePool directly and use the getTable and putTable methods to
get an HTable and return an HTable to the pool. The pool class will
automatically instantiate a new HTable in the case that no HTable for the given
table name is in the pool OR if the internal pool for that table name is full
(has more elements than its configured max size). The default max size is
Integer.MAX_VALUE.
While we lose the convenience of calling static methods, we gain a design with
less code that is easy to understand, easy to use in an IoC container, and easy
to unit test.
This patch also includes a small modification to HTable that allows an
instantiation to HTable with a null HBaseConfiguration object. This makes it
possible to unit test classes such as HTablePool that internally use an HTable
without requiring an environment in which the HTable can get and use a
connection.
Finally, this patch includes modifications to the stargate package reflecting
the new HTablePool API.
Let me know if this is suitable for inclusion in the project. Thanks to Jon
Gray and Stack for their help and input.
> Usability improvements to HTablePool
> ------------------------------------
>
> Key: HBASE-1655
> URL: https://issues.apache.org/jira/browse/HBASE-1655
> Project: Hadoop HBase
> Issue Type: Improvement
> Components: client
> Reporter: Ken Weiner
> Assignee: Ken Weiner
> Fix For: 0.20.0
>
> Attachments: HBASE-1655-HTablePool-commented.patch,
> HBASE-1655-v2-partial.patch, HBASE-1655-v3.patch, HBASE-1655.patch
>
>
> A discussion on the HBase user mailing list
> (http://markmail.org/thread/7leeha56ny5mwecg) led to some suggested
> improvements for the org.apache.hadoop.hbase.client.HTablePool class.
> I will be submitting a patch that contains the following changes to
> HTablePool:
> * Remove constructors that were not used.
> * Change access to remaining contstructor from public to private to enforce
> use of the static factory method getPool.
> * Change internal map from TreeMap to HashMap because I couldn't see any
> reason it needed to be sorted.
> * Remove HBaseConfiguration and tableName member variables since they aren't
> really properties of the pool itself. They are associated with the HTable
> that should get instantiated when one is requested from the pool, but not
> already there.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.