curator-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arrodrigues <...@git.apache.org>
Subject [GitHub] curator pull request #262: [CURATOR-460] Timed tolerance for connection susp...
Date Fri, 06 Apr 2018 03:03:31 GMT
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.


---

Mime
View raw message