HBASE-9425 Starting a LocalHBaseCluster when 2181 is occupied results in "Too many open files"

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1523809 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jean-Daniel Cryans 2013-09-16 21:04:39 +00:00
parent 1b4bed1a21
commit 2ee04ae2cf
1 changed files with 5 additions and 2 deletions

View File

@ -134,7 +134,8 @@ public class MiniZooKeeperCluster {
/** /**
* @param baseDir * @param baseDir
* @param numZooKeeperServers * @param numZooKeeperServers
* @return ClientPort server bound to. * @return ClientPort server bound to, -1 if there was a
* binding problem and we couldn't pick another port.
* @throws IOException * @throws IOException
* @throws InterruptedException * @throws InterruptedException
*/ */
@ -169,7 +170,9 @@ public class MiniZooKeeperCluster {
1000)); 1000));
} catch (BindException e) { } catch (BindException e) {
LOG.debug("Failed binding ZK Server to client port: " + LOG.debug("Failed binding ZK Server to client port: " +
tentativePort); tentativePort, e);
// We're told to use some port but it's occupied, fail
if (defaultClientPort > 0) return -1;
// This port is already in use, try to use another. // This port is already in use, try to use another.
tentativePort = selectClientPort(); tentativePort = selectClientPort();
continue; continue;