HBASE-13199 ADDENDUM Some small improvements on canary tool (Shaohui Liu)

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

Branch: refs/heads/hbase-12439
Commit: f4eb7191be66ada04c94cd555acbfe34efc350c1
Parents: 6d44603
Author: Liu Shaohui <liushao...@xiaomi.com>
Authored: Fri Mar 20 15:22:14 2015 -0500
Committer: Sean Busbey <bus...@cloudera.com>
Committed: Fri Mar 20 15:22:14 2015 -0500

----------------------------------------------------------------------
 .../java/org/apache/hadoop/hbase/tool/Canary.java    | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/f4eb7191/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/Canary.java
----------------------------------------------------------------------
diff --git 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/Canary.java 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/Canary.java
index 8efb73d..c8f0a72 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/Canary.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/Canary.java
@@ -153,14 +153,13 @@ public final class Canary implements Tool {
       } catch (IOException e) {
         LOG.debug("sniffRegion failed", e);
         sink.publishReadFailure(region, e);
-        return null;
-      } finally {
         if (table != null) {
           try {
             table.close();
-          } catch (IOException e) {
+          } catch (IOException ioe) {
           }
         }
+        return null;
       }
 
       byte[] startKey = null;
@@ -204,17 +203,15 @@ public final class Canary implements Tool {
           if (rs != null) {
             rs.close();
           }
-          if (table != null) {
-            try {
-              table.close();
-            } catch (IOException e) {
-            }
-          }
           scan = null;
           get = null;
           startKey = null;
         }
       }
+      try {
+        table.close();
+      } catch (IOException e) {
+      }
       return null;
     }
   }

Reply via email to