Return-Path: X-Original-To: apmail-hbase-commits-archive@www.apache.org Delivered-To: apmail-hbase-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 AE0051885C for ; Thu, 8 Oct 2015 21:35:02 +0000 (UTC) Received: (qmail 17803 invoked by uid 500); 8 Oct 2015 21:35:02 -0000 Delivered-To: apmail-hbase-commits-archive@hbase.apache.org Received: (qmail 17763 invoked by uid 500); 8 Oct 2015 21:35:02 -0000 Mailing-List: contact commits-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hbase.apache.org Delivered-To: mailing list commits@hbase.apache.org Received: (qmail 17754 invoked by uid 99); 8 Oct 2015 21:35:02 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 08 Oct 2015 21:35:02 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 6A115E0BD8; Thu, 8 Oct 2015 21:35:02 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: tedyu@apache.org To: commits@hbase.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: hbase git commit: HBASE-14565 Make ZK connection timeout configurable in MiniZooKeeperCluster Date: Thu, 8 Oct 2015 21:35:02 +0000 (UTC) Repository: hbase Updated Branches: refs/heads/branch-1 a048c32a9 -> 841f3924c HBASE-14565 Make ZK connection timeout configurable in MiniZooKeeperCluster Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/841f3924 Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/841f3924 Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/841f3924 Branch: refs/heads/branch-1 Commit: 841f3924cd599bbde4f9268e1b26ffee9bc722a6 Parents: a048c32 Author: tedyu Authored: Thu Oct 8 14:34:49 2015 -0700 Committer: tedyu Committed: Thu Oct 8 14:34:49 2015 -0700 ---------------------------------------------------------------------- .../hadoop/hbase/zookeeper/MiniZooKeeperCluster.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/841f3924/hbase-server/src/main/java/org/apache/hadoop/hbase/zookeeper/MiniZooKeeperCluster.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/zookeeper/MiniZooKeeperCluster.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/zookeeper/MiniZooKeeperCluster.java index 8b6f9de..ab74318 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/zookeeper/MiniZooKeeperCluster.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/zookeeper/MiniZooKeeperCluster.java @@ -55,7 +55,8 @@ public class MiniZooKeeperCluster { private static final Log LOG = LogFactory.getLog(MiniZooKeeperCluster.class); private static final int TICK_TIME = 2000; - private static final int CONNECTION_TIMEOUT = 30000; + private static final int DEFAULT_CONNECTION_TIMEOUT = 30000; + private int connectionTimeout; private boolean started; @@ -82,6 +83,8 @@ public class MiniZooKeeperCluster { zooKeeperServers = new ArrayList(); clientPortList = new ArrayList(); standaloneServerFactoryList = new ArrayList(); + connectionTimeout = configuration.getInt(HConstants.ZK_SESSION_TIMEOUT + ".localHBaseCluster", + DEFAULT_CONNECTION_TIMEOUT); } /** @@ -249,7 +252,7 @@ public class MiniZooKeeperCluster { // Start up this ZK server standaloneServerFactory.startup(server); // Runs a 'stat' against the servers. - if (!waitForServerUp(currentClientPort, CONNECTION_TIMEOUT)) { + if (!waitForServerUp(currentClientPort, connectionTimeout)) { throw new IOException("Waiting for startup of standalone server"); } @@ -296,7 +299,7 @@ public class MiniZooKeeperCluster { int clientPort = clientPortList.get(i); standaloneServerFactory.shutdown(); - if (!waitForServerDown(clientPort, CONNECTION_TIMEOUT)) { + if (!waitForServerDown(clientPort, connectionTimeout)) { throw new IOException("Waiting for shutdown of standalone server"); } } @@ -334,7 +337,7 @@ public class MiniZooKeeperCluster { int clientPort = clientPortList.get(activeZKServerIndex); standaloneServerFactory.shutdown(); - if (!waitForServerDown(clientPort, CONNECTION_TIMEOUT)) { + if (!waitForServerDown(clientPort, connectionTimeout)) { throw new IOException("Waiting for shutdown of standalone server"); } @@ -377,7 +380,7 @@ public class MiniZooKeeperCluster { int clientPort = clientPortList.get(backupZKServerIndex); standaloneServerFactory.shutdown(); - if (!waitForServerDown(clientPort, CONNECTION_TIMEOUT)) { + if (!waitForServerDown(clientPort, connectionTimeout)) { throw new IOException("Waiting for shutdown of standalone server"); }