Previous version was incorrectly re-using the instanceIndex. Need to use latest 
value


Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/8fbe4b7d
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/8fbe4b7d
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/8fbe4b7d

Branch: refs/heads/master
Commit: 8fbe4b7db66d157c951268f1ce07e08cf176bd77
Parents: 4f47e7b
Author: randgalt <randg...@apache.org>
Authored: Mon Jan 13 17:59:37 2014 -0500
Committer: randgalt <randg...@apache.org>
Committed: Mon Jan 13 17:59:37 2014 -0500

----------------------------------------------------------------------
 .../apache/curator/framework/imps/CuratorFrameworkImpl.java   | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/8fbe4b7d/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
----------------------------------------------------------------------
diff --git 
a/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
 
b/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
index f1258ea..d516f48 100644
--- 
a/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
+++ 
b/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
@@ -606,8 +606,11 @@ public class CuratorFrameworkImpl implements 
CuratorFramework
     {
         connectionStateManager.setToSuspended();
 
-        final long instanceIndex = client.getInstanceIndex();
+        doSyncForSuspendedConnection(client.getInstanceIndex());
+    }
 
+    private void doSyncForSuspendedConnection(final long instanceIndex)
+    {
         // we appear to have disconnected, force a new ZK event and see if we 
can connect to another server
         final BackgroundOperation<String> operation = new 
BackgroundSyncImpl(this, null);
         OperationAndData.ErrorCallback<String> errorCallback = new 
OperationAndData.ErrorCallback<String>()
@@ -625,7 +628,7 @@ public class CuratorFrameworkImpl implements 
CuratorFramework
                 else
                 {
                     log.debug("suspendConnection() failure ignored as the 
ZooKeeper instance was reset. Retrying.");
-                    performBackgroundOperation(new 
OperationAndData<String>(operation, "/", null, this, null));
+                    doSyncForSuspendedConnection(newInstanceIndex);
                 }
             }
         };

Reply via email to