Repository: curator Updated Branches: refs/heads/CURATOR-110 5954e66fa -> 03e736c66
minor refactor Project: http://git-wip-us.apache.org/repos/asf/curator/repo Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/03e736c6 Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/03e736c6 Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/03e736c6 Branch: refs/heads/CURATOR-110 Commit: 03e736c66c353eb05ae7257553e53d8c2983ce40 Parents: 5954e66 Author: randgalt <[email protected]> Authored: Tue Jun 17 17:04:00 2014 -0500 Committer: randgalt <[email protected]> Committed: Tue Jun 17 17:04:00 2014 -0500 ---------------------------------------------------------------------- .../curator/framework/state/ConnectionStateManager.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/curator/blob/03e736c6/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 fb312dc..2a0cdd1 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 @@ -193,16 +193,16 @@ public class ConnectionStateManager implements Closeable public synchronized boolean blockUntilConnected(int maxWaitTime, TimeUnit units) throws InterruptedException { - boolean hasMaxWait = (units != null); long startTime = System.currentTimeMillis(); + boolean hasMaxWait = (units != null); + long maxWaitTimeMs = hasMaxWait ? TimeUnit.MILLISECONDS.convert(maxWaitTime, units) : 0; + while ( !isConnected() ) { - long maxWaitTimeMS = hasMaxWait ? TimeUnit.MILLISECONDS.convert(maxWaitTime, units) : 0; - if ( hasMaxWait ) { - long waitTime = maxWaitTimeMS - (System.currentTimeMillis() - startTime); + long waitTime = maxWaitTimeMs - (System.currentTimeMillis() - startTime); if ( waitTime <= 0 ) { return isConnected();
