hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From te...@apache.org
Subject hbase git commit: HBASE-14565 Make ZK connection timeout configurable in MiniZooKeeperCluster
Date Thu, 08 Oct 2015 21:35:45 GMT
Repository: hbase
Updated Branches:
  refs/heads/master 4beefd8ce -> c8e280ec8


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/c8e280ec
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/c8e280ec
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/c8e280ec

Branch: refs/heads/master
Commit: c8e280ec88ce3b3688e6a1f5bdeddc3d3263067f
Parents: 4beefd8
Author: tedyu <yuzhihong@gmail.com>
Authored: Thu Oct 8 14:35:38 2015 -0700
Committer: tedyu <yuzhihong@gmail.com>
Committed: Thu Oct 8 14:35:38 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/c8e280ec/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");
     }
 


Mime
View raw message