Github user arrodrigues commented on a diff in the pull request: https://github.com/apache/curator/pull/262#discussion_r179650717 --- Diff: curator-framework/src/main/java/org/apache/curator/framework/state/ConnectionStateManager.java --- @@ -251,9 +251,15 @@ private void processEvents() { try { + + long localStartOfSuspendedEpoch; + synchronized (this) { + localStartOfSuspendedEpoch = this.startOfSuspendedEpoch; + } int lastNegotiatedSessionTimeoutMs = client.getZookeeperClient().getLastNegotiatedSessionTimeoutMs(); int useSessionTimeoutMs = (lastNegotiatedSessionTimeoutMs > 0) ? lastNegotiatedSessionTimeoutMs : sessionTimeoutMs; - long elapsedMs = startOfSuspendedEpoch == 0 ? useSessionTimeoutMs / 2 : System.currentTimeMillis() - startOfSuspendedEpoch; + useSessionTimeoutMs = sessionExpirationPercent > 0 && localStartOfSuspendedEpoch != 0 ? (useSessionTimeoutMs * sessionExpirationPercent) / 100 : useSessionTimeoutMs; --- End diff -- I think you mean useSessionTimeoutMs calc. I created a method for that. I'm not very happy with the name I gave to it "getUseSessionTimeoutMs", suggestions are certainly welcome.
---