You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by GitBox <gi...@apache.org> on 2020/10/28 04:17:15 UTC

[GitHub] [hbase] iamminji commented on a change in pull request #2592: HBASE-25223 Use try-with-resources statement

iamminji commented on a change in pull request #2592:
URL: https://github.com/apache/hbase/pull/2592#discussion_r513170799



##########
File path: hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/CreateSnapshot.java
##########
@@ -67,24 +67,14 @@ protected void processOptions(CommandLine cmd) {
 
     @Override
     protected int doWork() throws Exception {
-        Connection connection = null;
-        Admin admin = null;
-        try {
-            connection = ConnectionFactory.createConnection(getConf());
-            admin = connection.getAdmin();
+        try (Connection connection = ConnectionFactory.createConnection(getConf())) {

Review comment:
       Thank you :) I modified the code based on your suggestion.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org