diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ConnectionManager.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ConnectionManager.java index d3bdfad..b8cfcb5 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ConnectionManager.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ConnectionManager.java @@ -1474,6 +1474,7 @@ class ConnectionManager { Object makeStub() throws MasterNotRunningException { // The lock must be at the beginning to prevent multiple master creations // (and leaks) in a multithread context + final int NUM_TRIES = 2; synchronized (masterAndZKLock) { Exception exceptionCaught = null; Object stub = null; @@ -1492,10 +1493,10 @@ class ConnectionManager { if (exceptionCaught != null) // It failed. If it's not the last try, we're going to wait a little - if (tries < numTries && !ExceptionUtil.isInterrupt(exceptionCaught)) { + if (tries < NUM_TRIES && !ExceptionUtil.isInterrupt(exceptionCaught)) { // tries at this point is 1 or more; decrement to start from 0. long pauseTime = ConnectionUtils.getPauseTime(pause, tries - 1); - LOG.info("getMaster attempt " + tries + " of " + numTries + + LOG.info("getMaster attempt " + tries + " of " + NUM_TRIES + " failed; retrying after sleep of " + pauseTime + ", exception=" + exceptionCaught); @@ -1507,7 +1508,7 @@ class ConnectionManager { } } else { // Enough tries, we stop now - LOG.info("getMaster attempt " + tries + " of " + numTries + + LOG.info("getMaster attempt " + tries + " of " + NUM_TRIES + " failed; no more retrying.", exceptionCaught); throw new MasterNotRunningException(exceptionCaught); }