Return-Path: X-Original-To: apmail-hbase-dev-archive@www.apache.org Delivered-To: apmail-hbase-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BCEEFB773 for ; Tue, 10 Jan 2012 16:18:35 +0000 (UTC) Received: (qmail 76659 invoked by uid 500); 10 Jan 2012 16:18:35 -0000 Delivered-To: apmail-hbase-dev-archive@hbase.apache.org Received: (qmail 76573 invoked by uid 500); 10 Jan 2012 16:18:34 -0000 Mailing-List: contact dev-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hbase.apache.org Delivered-To: mailing list dev@hbase.apache.org Delivered-To: moderator for dev@hbase.apache.org Received: (qmail 34699 invoked by uid 99); 10 Jan 2012 10:57:36 -0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of stan.ieugen@gmail.com designates 209.85.220.169 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; bh=zAdz8AgpCSxVecJji5LR1MhcXvHAmg3mvZcfoPPl9ME=; b=b5bd40fxb+K53k+UQ7iJ9SaXhb4SQ3Brgg8N2kXu4tXe5TUdQA39adu/DdPyunlbur P3ogF03HRmGoritcvS4c6a1NvCKQKbSyxxg6IjayFEITyoMrN6JpqVeHNb88naBB2ihy GyklYiu9rw15tWMYPesFRh92Cta4S8UyhT4Xo= MIME-Version: 1.0 Date: Tue, 10 Jan 2012 12:57:08 +0200 Message-ID: Subject: HTableInterface to extend java.io.Closeable From: Ioan Eugen Stan To: dev@hbase.apache.org Content-Type: text/plain; charset=UTF-8 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/