Hello,
In my code I get to write a lot of boilerplate code to close a HTable
instance (see below snippet). Making HTableInterface extent
java.io.Closeable would allow developers to use IOUtils.closeQuietly()
from appache-commons or a similar method to cose a HTable instance
without the extra code. What do you think?
HTable table = null;
try {
table = new HTable(conf , "some table");
ResultScanner scanner = table.getScanner(scan);
Result result;
while ((result = scanner.next()) != null) {
// do something
}
scanner.close(); // close the scanner
} catch (IOException e) {
LOG.error("Exception scanning in table");
} finally {
// close the table
if (table != null) {
try {
table.close();
} catch (IOException e) {
}
}
}
Cheers,
--
Ioan Eugen Stan
http://ieugen.blogspot.com/