Github user Randgalt commented on a diff in the pull request:
https://github.com/apache/curator/pull/262#discussion_r179396466
--- 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 --
The `sessionExpirationPercent` calc is the same as in the other spot in the
code right? We can abstract a method that does this.
---