curator-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From randg...@apache.org
Subject [43/45] curator git commit: Use negotiated session timeout in processEvents()
Date Tue, 01 Sep 2015 13:28:35 GMT
Use negotiated session timeout in processEvents()


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

Branch: refs/heads/CURATOR-248
Commit: c641c0296275bb12a156c2a6a1655e0cc968fad4
Parents: 667b1d2
Author: randgalt <randgalt@apache.org>
Authored: Mon Aug 31 19:50:21 2015 -0700
Committer: randgalt <randgalt@apache.org>
Committed: Mon Aug 31 19:50:21 2015 -0700

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


http://git-wip-us.apache.org/repos/asf/curator/blob/c641c029/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 daa33f6..3d44d45 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
@@ -250,7 +250,9 @@ public class ConnectionStateManager implements Closeable
         {
             while ( !Thread.currentThread().isInterrupted() && (state.get() == State.STARTED)
)
             {
-                int pollMaxMs = (sessionTimeoutMs * 2) / 3; // 2/3 of session timeout
+                int lastNegotiatedSessionTimeoutMs = client.getZookeeperClient().getLastNegotiatedSessionTimeoutMs();
+                int useSessionTimeoutMs = (lastNegotiatedSessionTimeoutMs > 0) ? lastNegotiatedSessionTimeoutMs
: sessionTimeoutMs;
+                int pollMaxMs = (useSessionTimeoutMs * 2) / 3; // 2/3 of session timeout
                 final ConnectionState newState = eventQueue.poll(pollMaxMs, TimeUnit.MILLISECONDS);
                 if ( newState != null )
                 {


Mime
View raw message