Browse Source

rolling back excess checkin from ZOOKEEPER-961

git-svn-id: https://svn.apache.org/repos/asf/zookeeper/trunk@1172406 13f79535-47bb-0310-9956-ffa450edef68
Camille Fournier 13 years ago
parent
commit
4f7b7bfa1d
1 changed files with 8 additions and 8 deletions
  1. 8 8
      src/java/main/org/apache/zookeeper/ClientCnxn.java

+ 8 - 8
src/java/main/org/apache/zookeeper/ClientCnxn.java

@@ -914,6 +914,13 @@ public class ClientCnxn {
         private int pingRwTimeout = minPingRwTimeout;
 
         private void startConnect() throws IOException {
+            if(!isFirstConnect){
+                try {
+                    Thread.sleep(r.nextInt(1000));
+                } catch (InterruptedException e) {
+                    LOG.warn("Unexpected exception", e);
+                }
+            }
             state = States.CONNECTING;
 
             InetSocketAddress addr;
@@ -956,15 +963,8 @@ public class ClientCnxn {
             while (state.isAlive()) {
                 try {
                     if (!clientCnxnSocket.isConnected()) {
-                        if(!isFirstConnect){
-                            try {
-                                Thread.sleep(r.nextInt(1000));
-                            } catch (InterruptedException e) {
-                                LOG.warn("Unexpected exception", e);
-                            }
-                        }
                         // don't re-establish connection if we are closing
-                        if (closing || !state.isAlive()) {
+                        if (closing) {
                             break;
                         }
                         startConnect();