Return-Path: X-Original-To: apmail-accumulo-commits-archive@www.apache.org Delivered-To: apmail-accumulo-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 953C710960 for ; Fri, 7 Mar 2014 20:54:17 +0000 (UTC) Received: (qmail 22353 invoked by uid 500); 7 Mar 2014 20:53:42 -0000 Delivered-To: apmail-accumulo-commits-archive@accumulo.apache.org Received: (qmail 21264 invoked by uid 500); 7 Mar 2014 20:53:20 -0000 Mailing-List: contact commits-help@accumulo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@accumulo.apache.org Delivered-To: mailing list commits@accumulo.apache.org Received: (qmail 21155 invoked by uid 99); 7 Mar 2014 20:53:17 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 07 Mar 2014 20:53:17 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id DBB4893A857; Fri, 7 Mar 2014 20:53:15 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: elserj@apache.org To: commits@accumulo.apache.org Date: Fri, 07 Mar 2014 20:53:27 -0000 Message-Id: In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [13/50] [abbrv] git commit: ACCUMULO-2427 close the open socket, allow for info after imok, report the last exception 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/ACCUMULO-2061 Commit: 9ff2c452311bcbc825196f7e361e312f232523ed Parents: 04d8cd8 Author: Eric Newton Authored: Tue Mar 4 12:44:56 2014 -0500 Committer: Eric Newton 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());