gora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lewi...@apache.org
Subject gora git commit: GORA-459 Resource leak due to unclosed Table this closes #51
Date Wed, 27 Jan 2016 05:12:47 GMT
Repository: gora
Updated Branches:
  refs/heads/master 73a649fbc -> 4968823b5


GORA-459 Resource leak due to unclosed Table this closes #51


Project: http://git-wip-us.apache.org/repos/asf/gora/repo
Commit: http://git-wip-us.apache.org/repos/asf/gora/commit/4968823b
Tree: http://git-wip-us.apache.org/repos/asf/gora/tree/4968823b
Diff: http://git-wip-us.apache.org/repos/asf/gora/diff/4968823b

Branch: refs/heads/master
Commit: 4968823b5a8ba6d8abe796414616584f6c104893
Parents: 73a649f
Author: Lewis John McGibbney <lewis.j.mcgibbney@jpl.nasa.gov>
Authored: Tue Jan 26 21:15:54 2016 -0800
Committer: Lewis John McGibbney <lewis.j.mcgibbney@jpl.nasa.gov>
Committed: Tue Jan 26 21:15:54 2016 -0800

----------------------------------------------------------------------
 .../org/apache/gora/hbase/util/HBaseClusterSingleton.java     | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/gora/blob/4968823b/gora-hbase/src/test/java/org/apache/gora/hbase/util/HBaseClusterSingleton.java
----------------------------------------------------------------------
diff --git a/gora-hbase/src/test/java/org/apache/gora/hbase/util/HBaseClusterSingleton.java
b/gora-hbase/src/test/java/org/apache/gora/hbase/util/HBaseClusterSingleton.java
index 9de2dc2..4110645 100644
--- a/gora-hbase/src/test/java/org/apache/gora/hbase/util/HBaseClusterSingleton.java
+++ b/gora-hbase/src/test/java/org/apache/gora/hbase/util/HBaseClusterSingleton.java
@@ -27,6 +27,7 @@ import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.HTableDescriptor;
 import org.apache.hadoop.hbase.MiniHBaseCluster;
 import org.apache.hadoop.hbase.client.HBaseAdmin;
+import org.apache.hadoop.hbase.client.HTable;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -152,7 +153,8 @@ public final class HBaseClusterSingleton {
   public void ensureTable(byte[] tableName, byte[][] cfs) throws IOException {
     HBaseAdmin admin = htu.getHBaseAdmin();
     if (!admin.tableExists(tableName)) {
-      htu.createTable(tableName, cfs);
+      HTable hTable = htu.createTable(tableName, cfs);
+      hTable.close();
     }
   }
 
@@ -163,7 +165,8 @@ public final class HBaseClusterSingleton {
   public void truncateAllTables() throws Exception {
     HBaseAdmin admin = htu.getHBaseAdmin();
     for(HTableDescriptor table:admin.listTables()) {
-      htu.truncateTable(table.getName());
+      HTable hTable = htu.truncateTable(table.getName());
+      hTable.close();
     }
   }
   


Mime
View raw message