I've edited the JIRA description to be more formal
On 07/01/2011 07:10 PM, Ted Yu wrote:
When logging JIRA, please use formal writing instead of pasting contents of
email directly.
I will post a comment on the JIRA related to PooledHTable.close().
On Fri, Jul 1, 2011 at 9:06 AM, Daniel Iancu<[email protected]> wrote:
HTablePoolEnhanced.close is inherited and should do same thing on the
enhanced pool
Jira opened with patch
https://issues.apache.org/**jira/browse/HBASE-4054<https://issues.apache.org/jira/browse/HBASE-4054>
Have a look and let me know if it needs changes
On 07/01/2011 05:42 PM, Srikanth P. Shreenivas wrote:
This will be very helpful. Also, wouldn't it be good idea to add close()
to HTablePoolEnhanced so that underlying HTables can be closed by client
apps as part of application shutdown.
Regards,
Srikanth
-----Original Message-----
From: Daniel Iancu [mailto:[email protected]]
Sent: Friday, July 01, 2011 7:55 PM
To: [email protected]
Subject: Usability improvement to HTablePool
Hi
It look like the usage of HTablePool might be improved. Now, once you
get the connection from pool you must take good care to return it by
calling HTablePool.putTable(table);
If you close the table (say, you don't read carefully the Javadoc)
your htable will not be reused.
Other case might be if you build a Datasource like object to obtain
HTables and, in this case, from the client you don't have a reference to
the pool to return the table once done with it.
I've fixed all this by subclassing the HTablePool and overriding the
getTable method
public class HTablePoolEnhanced extends HTablePool
@Override
public HTableInterface getTable(String tableName) {
return new PooledHTable(super.getTable(**tableName));
}
where PooledHTable is a inner class that wraps a HTable and
reimplements the close method to return the table to pool
public class PooledHTable implements HTableInterface {
private HTableInterface table;
public PooledHTable(HTableInterface table) {
this.table = table;
}
@Override
public void close() throws IOException {
putTable(table);
}
...
}
}
Does it make sense to have this implementation in Hbase also ? It look
that all it needs is to have a new HTableInterfaceFactory implementation
to create some proxy tables like i did.
Regards
Daniel
______________________________**__
http://www.mindtree.com/email/**disclaimer.html<http://www.mindtree.com/email/disclaimer.html>
--
Daniel Iancu
Java Developer,Web Components Romania
1&1 Internet Development srl.
18 Mircea Eliade St
Sect 1, Bucharest
RO Bucharest, 012015
www.1and1.ro
Phone:+40-031-223-9081
--
Daniel Iancu
Java Developer,Web Components Romania
1&1 Internet Development srl.
18 Mircea Eliade St
Sect 1, Bucharest
RO Bucharest, 012015
www.1and1.ro
Phone:+40-031-223-9081