code for useSessionTimeoutMs was wrong

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

Branch: refs/heads/CURATOR-248
Commit: dd788163a278e2c10f71d2f0fd8b68137806f9f0
Parents: 966b8df
Author: randgalt <randg...@apache.org>
Authored: Sun Aug 23 20:33:55 2015 -0500
Committer: randgalt <randg...@apache.org>
Committed: Sun Aug 23 20:33:55 2015 -0500

----------------------------------------------------------------------
 .../apache/curator/framework/state/ConnectionStateManager.java    | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/dd788163/curator-framework/src/main/java/org/apache/curator/framework/state/ConnectionStateManager.java
----------------------------------------------------------------------
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 3da7534..de71264 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
@@ -292,7 +292,8 @@ public class ConnectionStateManager implements Closeable
         if ( (currentConnectionState == ConnectionState.SUSPENDED) && 
(startOfSuspendedEpoch != 0) )
         {
             long elapsedMs = System.currentTimeMillis() - 
startOfSuspendedEpoch;
-            int useSessionTimeoutMs = 
Math.max(client.getZookeeperClient().getLastNegotiatedSessionTimeoutMs(), 
sessionTimeoutMs);
+            int lastNegotiatedSessionTimeoutMs = 
client.getZookeeperClient().getLastNegotiatedSessionTimeoutMs();
+            int useSessionTimeoutMs = (lastNegotiatedSessionTimeoutMs > 0) ? 
lastNegotiatedSessionTimeoutMs : sessionTimeoutMs;
             if ( elapsedMs >= useSessionTimeoutMs )
             {
                 log.warn(String.format("Session timeout has elapsed while 
SUSPENDED. Posting LOST event and resetting the connection. Elapsed ms: %d. 
Session Timeout ms: %d", elapsedMs, useSessionTimeoutMs));

Reply via email to