Repository: accumulo Updated Branches: refs/heads/1.6.0-SNAPSHOT 9abf9424d -> ca61fe814
ACCUMULO-2427 close the open socket, allow for info after imok, report the last exception Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/9ff2c452 Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/9ff2c452 Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/9ff2c452 Branch: refs/heads/1.6.0-SNAPSHOT Commit: 9ff2c452311bcbc825196f7e361e312f232523ed Parents: 04d8cd8 Author: Eric Newton <eric.new...@gmail.com> Authored: Tue Mar 4 12:44:56 2014 -0500 Committer: Eric Newton <eric.new...@gmail.com> Committed: Tue Mar 4 12:44:56 2014 -0500 ---------------------------------------------------------------------- .../minicluster/impl/MiniAccumuloClusterImpl.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/9ff2c452/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloClusterImpl.java ---------------------------------------------------------------------- diff --git a/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloClusterImpl.java b/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloClusterImpl.java index c1b3b8b..492205e 100644 --- a/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloClusterImpl.java +++ b/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloClusterImpl.java @@ -442,19 +442,23 @@ public class MiniAccumuloClusterImpl { // sleep a little bit to let zookeeper come up before calling init, seems to work better long startTime = System.currentTimeMillis(); while (true) { + Socket s = null; try { - Socket s = new Socket("localhost", config.getZooKeeperPort()); + s = new Socket("localhost", config.getZooKeeperPort()); s.getOutputStream().write("ruok\n".getBytes()); s.getOutputStream().flush(); byte buffer[] = new byte[100]; int n = s.getInputStream().read(buffer); - if (n == 4 && new String(buffer, 0, n).equals("imok")) + if (n >= 4 && new String(buffer, 0, 4).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."); + throw new RuntimeException("Zookeeper did not start within 10 seconds. Check the logs in " + config.getLogDir() + " for errors. Last exception: " + e); } UtilWaitThread.sleep(250); + } finally { + if (s != null) + s.close(); } } Process initProcess = exec(Initialize.class, "--instance-name", config.getInstanceName(), "--password", config.getRootPassword());