[bug fix] HBaseAdmin may leak ZooKeeper connections

HBaseAdmin may leak ZooKeeper connections

When master crashs, HBaseAdmin will leaks ZooKeeper connections
I think we should close the zk connetion when throw MasterNotRunningException
public HBaseAdmin(Configuration c)
throws MasterNotRunningException, ZooKeeperConnectionException {
this.conf = HBaseConfiguration.create(c);
this.connection = HConnectionManager.getConnection(this.conf);
this.pause = this.conf.getLong("hbase.client.pause", 1000);
this.numRetries = this.conf.getInt("hbase.client.retries.number", 10);
this.retryLongerMultiplier = this.conf.getInt("hbase.client.retries.longer.multiplier", 10);
//we should add this code and close the zk connection
try{ this.connection.getMaster(); }catch(MasterNotRunningException e){ HConnectionManager.deleteConnection(conf, false); throw e; }
}

猜你喜欢

转载自marsorp.iteye.com/blog/1553369