hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mingtao Zhang <mail2ming...@gmail.com>
Subject table.close()?
Date Mon, 11 Aug 2014 18:28:32 GMT
Hi,

I am looking at some code like this.

    public void put(String tableName, Put put) {
        HTableInterface table = null;
        try {
            table = connection.getTable(tableName);
            table.put(put);
        } catch (Throwable e) {
            log.error("put to HBase failed", e);
        } finally {
            if (null != table) {
                try {
                    //
http://hbase.apache.org/book/perf.writing.html#perf.hbase.client.autoflush
                    table.close();
                } catch (Exception e) {
                    log.error("close HTable failed", e);
                }
            }
        }
    }

By looking at the documentation, conncetion.getTable(tableName) will be a
'cheap' operation. But table.close() will flush things to network.

I wonder do I need to call table.close()? or it will be managed by HBase
client?

Best Regards,
Mingtao

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message