This is an automated email from the ASF dual-hosted git repository.

randgalt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/curator.git

commit 003f6f0082163889d9a1d423ad62095cc41a1366
Author: randgalt <randg...@apache.org>
AuthorDate: Thu Apr 2 08:16:41 2020 -0500

    CURATOR-525 - instead of resetting the connection, change the state to 
RECONNECTED. I'm concerned about LOST/reset loops. This is still a bad hack and 
needs to be addressed in the future.
---
 .../curator/framework/state/ConnectionStateManager.java     | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git 
a/curator-framework/src/main/java/org/apache/curator/framework/state/ConnectionStateManager.java
 
b/curator-framework/src/main/java/org/apache/curator/framework/state/ConnectionStateManager.java
index 32ddb78..9ee09b0 100644
--- 
a/curator-framework/src/main/java/org/apache/curator/framework/state/ConnectionStateManager.java
+++ 
b/curator-framework/src/main/java/org/apache/curator/framework/state/ConnectionStateManager.java
@@ -291,16 +291,9 @@ public class ConnectionStateManager implements Closeable
                     if ( (currentConnectionState == ConnectionState.LOST) && 
client.getZookeeperClient().isConnected() )
                     {
                         // CURATOR-525 - there is a race whereby LOST is 
sometimes set after the connection has been repaired
-                        // this "hack" fixes it by resetting the connection
-                        log.warn("ConnectionState is LOST but isConnected() is 
true. Resetting connection.");
-                        try
-                        {
-                            client.getZookeeperClient().reset();
-                        }
-                        catch ( Exception e )
-                        {
-                            log.error("Could not reset connection after 
LOST/isConnected mismatch");
-                        }
+                        // this "hack" fixes it by forcing the state to 
RECONNECTED
+                        log.warn("ConnectionState is LOST but isConnected() is 
true. Forcing RECONNECTED.");
+                        addStateChange(ConnectionState.RECONNECTED);
                     }
                 }
             }

Reply via email to