incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject [4/7] git commit: Fixing a bug where the retry logic wasn't working when the initial connection failed. This could happen if one of the ZooKeeper server is down.
Date Thu, 16 May 2013 20:45:21 GMT
Fixing a bug where the retry logic wasn't working when the initial connection failed.  This
could happen if one of the ZooKeeper server is down.


Project: http://git-wip-us.apache.org/repos/asf/incubator-blur/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-blur/commit/a1a0eaef
Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/a1a0eaef
Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/a1a0eaef

Branch: refs/heads/0.1.5
Commit: a1a0eaefc6dea9d926bdcf64838842a70d5b1fca
Parents: c2bc98a
Author: Aaron McCurry <amccurry@gmail.com>
Authored: Thu May 16 16:10:21 2013 -0400
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Thu May 16 16:10:21 2013 -0400

----------------------------------------------------------------------
 .../org/apache/blur/zookeeper/ZooKeeperClient.java |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/a1a0eaef/src/blur-util/src/main/java/org/apache/blur/zookeeper/ZooKeeperClient.java
----------------------------------------------------------------------
diff --git a/src/blur-util/src/main/java/org/apache/blur/zookeeper/ZooKeeperClient.java b/src/blur-util/src/main/java/org/apache/blur/zookeeper/ZooKeeperClient.java
index 9996eb7..62ad5c7 100644
--- a/src/blur-util/src/main/java/org/apache/blur/zookeeper/ZooKeeperClient.java
+++ b/src/blur-util/src/main/java/org/apache/blur/zookeeper/ZooKeeperClient.java
@@ -34,24 +34,29 @@ import org.apache.zookeeper.data.Stat;
 public class ZooKeeperClient extends ZooKeeper {
 
   private static final Log LOG = LogFactory.getLog(ZooKeeperClient.class);
+  private final int internalSessionTimeout;
 
   public ZooKeeperClient(String connectString, int sessionTimeout, Watcher watcher) throws
IOException {
     super(connectString, sessionTimeout, watcher);
+    internalSessionTimeout = sessionTimeout;
   }
 
   public ZooKeeperClient(String connectString, int sessionTimeout, Watcher watcher, boolean
canBeReadOnly)
       throws IOException {
     super(connectString, sessionTimeout, watcher, canBeReadOnly);
+    internalSessionTimeout = sessionTimeout;
   }
 
   public ZooKeeperClient(String connectString, int sessionTimeout, Watcher watcher, long
sessionId,
       byte[] sessionPasswd, boolean canBeReadOnly) throws IOException {
     super(connectString, sessionTimeout, watcher, sessionId, sessionPasswd, canBeReadOnly);
+    internalSessionTimeout = sessionTimeout;
   }
 
   public ZooKeeperClient(String connectString, int sessionTimeout, Watcher watcher, long
sessionId, byte[] sessionPasswd)
       throws IOException {
     super(connectString, sessionTimeout, watcher, sessionId, sessionPasswd);
+    internalSessionTimeout = sessionTimeout;
   }
 
   static abstract class ZKExecutor<T> {
@@ -61,6 +66,9 @@ public class ZooKeeperClient extends ZooKeeper {
   public <T> T execute(ZKExecutor<T> executor) throws KeeperException, InterruptedException
{
     final long timestmap = System.currentTimeMillis();
     int sessionTimeout = getSessionTimeout();
+    if (sessionTimeout == 0) {
+      sessionTimeout = internalSessionTimeout;
+    }
     while (true) {
       try {
         return executor.execute();


Mime
View raw message