storm-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kabh...@apache.org
Subject [1/3] storm git commit: STORM-1899 : release HBase connection when topology shutdown
Date Fri, 08 Jul 2016 09:19:22 GMT
Repository: storm
Updated Branches:
  refs/heads/master b83a8b9bc -> f57c9aada


STORM-1899 : release HBase connection when topology shutdown


Project: http://git-wip-us.apache.org/repos/asf/storm/repo
Commit: http://git-wip-us.apache.org/repos/asf/storm/commit/82b1ad03
Tree: http://git-wip-us.apache.org/repos/asf/storm/tree/82b1ad03
Diff: http://git-wip-us.apache.org/repos/asf/storm/diff/82b1ad03

Branch: refs/heads/master
Commit: 82b1ad032f237ede2d4e7c0bcb305f8e36355e3e
Parents: 0b54767
Author: darionyaphet <darion.yaphet@gmail.com>
Authored: Wed Jun 15 00:21:44 2016 +0800
Committer: darionyaphet <darion.yaphet@gmail.com>
Committed: Wed Jun 15 00:21:44 2016 +0800

----------------------------------------------------------------------
 .../org/apache/storm/hbase/bolt/AbstractHBaseBolt.java    | 10 ++++++++++
 .../java/org/apache/storm/hbase/common/HBaseClient.java   |  8 +++++++-
 2 files changed, 17 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/storm/blob/82b1ad03/external/storm-hbase/src/main/java/org/apache/storm/hbase/bolt/AbstractHBaseBolt.java
----------------------------------------------------------------------
diff --git a/external/storm-hbase/src/main/java/org/apache/storm/hbase/bolt/AbstractHBaseBolt.java
b/external/storm-hbase/src/main/java/org/apache/storm/hbase/bolt/AbstractHBaseBolt.java
index 9b77700..76a0f8a 100644
--- a/external/storm-hbase/src/main/java/org/apache/storm/hbase/bolt/AbstractHBaseBolt.java
+++ b/external/storm-hbase/src/main/java/org/apache/storm/hbase/bolt/AbstractHBaseBolt.java
@@ -29,6 +29,7 @@ import org.apache.storm.hbase.common.HBaseClient;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.io.IOException;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -73,4 +74,13 @@ public abstract class AbstractHBaseBolt extends BaseRichBolt {
         hbaseConfMap.put(Config.TOPOLOGY_AUTO_CREDENTIALS, map.get(Config.TOPOLOGY_AUTO_CREDENTIALS));
         this.hBaseClient = new HBaseClient(hbaseConfMap, hbConfig, tableName);
     }
+
+    @Override
+    public void cleanup() {
+        try {
+            hBaseClient.close();
+        } catch (IOException e) {
+            LOG.error("HBase Client Close Failed ", e);
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/storm/blob/82b1ad03/external/storm-hbase/src/main/java/org/apache/storm/hbase/common/HBaseClient.java
----------------------------------------------------------------------
diff --git a/external/storm-hbase/src/main/java/org/apache/storm/hbase/common/HBaseClient.java
b/external/storm-hbase/src/main/java/org/apache/storm/hbase/common/HBaseClient.java
index 94b5d51..f6f97b1 100644
--- a/external/storm-hbase/src/main/java/org/apache/storm/hbase/common/HBaseClient.java
+++ b/external/storm-hbase/src/main/java/org/apache/storm/hbase/common/HBaseClient.java
@@ -26,12 +26,13 @@ import org.apache.storm.hbase.security.HBaseSecurityUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.io.Closeable;
 import java.io.IOException;
 import java.security.PrivilegedExceptionAction;
 import java.util.List;
 import java.util.Map;
 
-public class HBaseClient {
+public class HBaseClient implements Closeable{
     private static final Logger LOG = LoggerFactory.getLogger(HBaseClient.class);
 
     private HTable table;
@@ -132,4 +133,9 @@ public class HBaseClient {
             throw e;
         }
     }
+
+    @Override
+    public void close() throws IOException {
+        table.close();
+    }
 }


Mime
View raw message