shaofengshi closed pull request #271: KYLIN-3603 Close the HBase connection 
after used in UpdateHTableHostCLI
URL: https://github.com/apache/kylin/pull/271
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/storage-hbase/src/main/java/org/apache/kylin/storage/hbase/util/UpdateHTableHostCLI.java
 
b/storage-hbase/src/main/java/org/apache/kylin/storage/hbase/util/UpdateHTableHostCLI.java
index bf5c4e84e0..ae8582cd5c 100644
--- 
a/storage-hbase/src/main/java/org/apache/kylin/storage/hbase/util/UpdateHTableHostCLI.java
+++ 
b/storage-hbase/src/main/java/org/apache/kylin/storage/hbase/util/UpdateHTableHostCLI.java
@@ -59,9 +59,10 @@
     public UpdateHTableHostCLI(List<String> htables, String oldHostValue) 
throws IOException {
         this.htables = htables;
         this.oldHostValue = oldHostValue;
-        Connection conn = 
ConnectionFactory.createConnection(HBaseConfiguration.create());
-        hbaseAdmin = conn.getAdmin();
-        this.kylinConfig = KylinConfig.getInstanceFromEnv();
+        try (Connection conn = 
ConnectionFactory.createConnection(HBaseConfiguration.create());) {
+            hbaseAdmin = conn.getAdmin();
+            this.kylinConfig = KylinConfig.getInstanceFromEnv();
+        }
     }
 
     public static void main(String[] args) throws Exception {


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to