You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by te...@apache.org on 2015/10/08 23:35:02 UTC
hbase git commit: HBASE-14565 Make ZK connection timeout configurable
in MiniZooKeeperCluster
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 <yu...@gmail.com>
Authored: Thu Oct 8 14:34:49 2015 -0700
Committer: tedyu <yu...@gmail.com>
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<ZooKeeperServer>();
clientPortList = new ArrayList<Integer>();
standaloneServerFactoryList = new ArrayList<NIOServerCnxnFactory>();
+ 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");
}