Repository: hbase
Updated Branches:
  refs/heads/0.94 71be2f036 -> ec8cfe14f


HBASE-13131 ReplicationAdmin must clean up connections if constructor fails.

Conflicts:
        
hbase-client/src/main/java/org/apache/hadoop/hbase/client/replication/ReplicationAdmin.java


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

Branch: refs/heads/0.94
Commit: ec8cfe14f1a558b5da1d1987d53cccf3ce0bd5f4
Parents: 71be2f0
Author: Sean Busbey <bus...@apache.org>
Authored: Sat Feb 28 19:58:30 2015 -0600
Committer: Sean Busbey <bus...@apache.org>
Committed: Sat Feb 28 20:43:00 2015 -0600

----------------------------------------------------------------------
 .../hbase/client/replication/ReplicationAdmin.java     | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/ec8cfe14/src/main/java/org/apache/hadoop/hbase/client/replication/ReplicationAdmin.java
----------------------------------------------------------------------
diff --git 
a/src/main/java/org/apache/hadoop/hbase/client/replication/ReplicationAdmin.java
 
b/src/main/java/org/apache/hadoop/hbase/client/replication/ReplicationAdmin.java
index ac3bc81..2a0f0ca 100644
--- 
a/src/main/java/org/apache/hadoop/hbase/client/replication/ReplicationAdmin.java
+++ 
b/src/main/java/org/apache/hadoop/hbase/client/replication/ReplicationAdmin.java
@@ -99,8 +99,17 @@ public class ReplicationAdmin implements Closeable {
     ZooKeeperWatcher zkw = this.connection.getZooKeeperWatcher();
     try {
       this.replicationZk = new ReplicationZookeeper(this.connection, conf, 
zkw);
-    } catch (KeeperException e) {
-      throw new IOException("Unable setup the ZooKeeper connection", e);
+    } catch (Exception exception) {
+      if (connection != null) {
+        connection.close();
+      }
+      if (exception instanceof IOException) {
+        throw (IOException) exception;
+      } else if (exception instanceof RuntimeException) {
+        throw (RuntimeException) exception;
+      } else {
+        throw new IOException("Unable setup the ZooKeeper connection", 
exception);
+      }
     }
   }
 

Reply via email to