You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@helix.apache.org by jx...@apache.org on 2017/06/22 22:58:07 UTC

[48/50] [abbrv] helix git commit: [HELIX-660]Configurable operation timeout for Helix ZKClient.

[HELIX-660]Configurable operation timeout for Helix ZKClient.


Project: http://git-wip-us.apache.org/repos/asf/helix/repo
Commit: http://git-wip-us.apache.org/repos/asf/helix/commit/2ae13d09
Tree: http://git-wip-us.apache.org/repos/asf/helix/tree/2ae13d09
Diff: http://git-wip-us.apache.org/repos/asf/helix/diff/2ae13d09

Branch: refs/heads/master
Commit: 2ae13d09b8d34b0db45f46a39dea51691e9e7c63
Parents: e1d867c
Author: Lei Xia <lx...@linkedin.com>
Authored: Fri Jun 9 17:20:22 2017 -0700
Committer: Lei Xia <lx...@linkedin.com>
Committed: Fri Jun 9 17:20:22 2017 -0700

----------------------------------------------------------------------
 .../org/apache/helix/manager/zk/ZkClient.java   | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/helix/blob/2ae13d09/helix-core/src/main/java/org/apache/helix/manager/zk/ZkClient.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/manager/zk/ZkClient.java b/helix-core/src/main/java/org/apache/helix/manager/zk/ZkClient.java
index 47d31d1..a4edc91 100644
--- a/helix-core/src/main/java/org/apache/helix/manager/zk/ZkClient.java
+++ b/helix-core/src/main/java/org/apache/helix/manager/zk/ZkClient.java
@@ -58,11 +58,13 @@ public class ZkClient extends org.I0Itec.zkclient.ZkClient {
   public ZkClient(IZkConnection connection, int connectionTimeout,
       PathBasedZkSerializer zkSerializer) {
     super(connection, connectionTimeout, new ByteArraySerializer());
-    _zkSerializer = zkSerializer;
-    if (LOG.isTraceEnabled()) {
-      StackTraceElement[] calls = Thread.currentThread().getStackTrace();
-      LOG.trace("created a zkclient. callstack: " + Arrays.asList(calls));
-    }
+    init(zkSerializer);
+  }
+
+  public ZkClient(IZkConnection connection, int connectionTimeout,
+      PathBasedZkSerializer zkSerializer, long operationRetryTimeout) {
+    super(connection, connectionTimeout, new ByteArraySerializer(), operationRetryTimeout);
+    init(zkSerializer);
   }
 
   public ZkClient(IZkConnection connection, int connectionTimeout, ZkSerializer zkSerializer) {
@@ -100,6 +102,14 @@ public class ZkClient extends org.I0Itec.zkclient.ZkClient {
     this(new ZkConnection(zkServers), Integer.MAX_VALUE, new SerializableSerializer());
   }
 
+  protected void init(PathBasedZkSerializer zkSerializer) {
+    _zkSerializer = zkSerializer;
+    if (LOG.isTraceEnabled()) {
+      StackTraceElement[] calls = Thread.currentThread().getStackTrace();
+      LOG.trace("created a zkclient. callstack: " + Arrays.asList(calls));
+    }
+  }
+
   @Override
   public void setZkSerializer(ZkSerializer zkSerializer) {
     _zkSerializer = new BasicZkSerializer(zkSerializer);