You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by cj...@apache.org on 2013/10/17 03:55:06 UTC
git commit: ACCUMULO-1752 Added 10 second timeout if Zookeeper
process fails during MAC start
Updated Branches:
refs/heads/master 493fc03f1 -> 929279c79
ACCUMULO-1752 Added 10 second timeout if Zookeeper process fails during MAC start
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/929279c7
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/929279c7
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/929279c7
Branch: refs/heads/master
Commit: 929279c79907d7f87b208290de0859cca61ccb96
Parents: 493fc03
Author: Corey J. Nolet <cj...@gmail.com>
Authored: Wed Oct 16 21:55:11 2013 -0400
Committer: Corey J. Nolet <cj...@gmail.com>
Committed: Wed Oct 16 21:55:11 2013 -0400
----------------------------------------------------------------------
.../org/apache/accumulo/minicluster/MiniAccumuloCluster.java | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/929279c7/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloCluster.java
----------------------------------------------------------------------
diff --git a/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloCluster.java b/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloCluster.java
index 1cb8f04..7deb980 100644
--- a/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloCluster.java
+++ b/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloCluster.java
@@ -411,7 +411,8 @@ public class MiniAccumuloCluster {
if (!initialized) {
// sleep a little bit to let zookeeper come up before calling init, seems to work better
- while (true) {
+ long startTime = System.currentTimeMillis();
+ while (true) {
try {
Socket s = new Socket("localhost", config.getZooKeeperPort());
s.getOutputStream().write("ruok\n".getBytes());
@@ -421,6 +422,9 @@ public class MiniAccumuloCluster {
if (n == 4 && new String(buffer, 0, n).equals("imok"))
break;
} catch (Exception e) {
+ if(System.currentTimeMillis() - startTime >= 10000) {
+ throw new RuntimeException("Zookeeper did not start within 10 seconds . Check the logs in " + config.getLogDir() + " for errors.");
+ }
UtilWaitThread.sleep(250);
}
}