curator-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From randg...@apache.org
Subject [28/45] curator git commit: Merge branch 'CURATOR-3.0' into CURATOR-247
Date Tue, 01 Sep 2015 13:28:20 GMT
Merge branch 'CURATOR-3.0' into CURATOR-247

Conflicts:
	curator-client/src/main/java/org/apache/curator/ConnectionState.java


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

Branch: refs/heads/CURATOR-248
Commit: 1bbf301ab75debf8866c78f13a32e65049a20772
Parents: 81bab45 f9af0ce
Author: randgalt <randgalt@apache.org>
Authored: Mon Aug 24 08:02:08 2015 -0500
Committer: randgalt <randgalt@apache.org>
Committed: Mon Aug 24 08:02:08 2015 -0500

----------------------------------------------------------------------
 .../org/apache/curator/ConnectionState.java     | 36 +++++++++-----------
 .../framework/imps/TestBlockUntilConnected.java | 24 +++++++++++++
 2 files changed, 41 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/1bbf301a/curator-client/src/main/java/org/apache/curator/ConnectionState.java
----------------------------------------------------------------------
diff --cc curator-client/src/main/java/org/apache/curator/ConnectionState.java
index 555a52d,46ae9fd..f0996d8
--- a/curator-client/src/main/java/org/apache/curator/ConnectionState.java
+++ b/curator-client/src/main/java/org/apache/curator/ConnectionState.java
@@@ -44,10 -41,9 +44,10 @@@ class ConnectionState implements Watche
  {
      private static final int MAX_BACKGROUND_EXCEPTIONS = 10;
      private static final boolean LOG_EVENTS = Boolean.getBoolean(DebugUtils.PROPERTY_LOG_EVENTS);
-     private final Logger log = LoggerFactory.getLogger(getClass());
+     private static final Logger log = LoggerFactory.getLogger(ConnectionState.class);
      private final HandleHolder zooKeeper;
      private final AtomicBoolean isConnected = new AtomicBoolean(false);
 +    private final AtomicInteger lastNegotiatedSessionTimeoutMs = new AtomicInteger(0);
      private final EnsembleProvider ensembleProvider;
      private final int sessionTimeoutMs;
      private final int connectionTimeoutMs;
@@@ -156,29 -145,22 +156,27 @@@
              log.debug("ConnectState watcher: " + event);
          }
  
-         for ( Watcher parentWatcher : parentWatchers )
-         {
-             TimeTrace timeTrace = new TimeTrace("connection-state-parent-process", tracer.get());
-             parentWatcher.process(event);
-             timeTrace.commit();
-         }
- 
-         boolean wasConnected = isConnected.get();
-         boolean newIsConnected = wasConnected;
          if ( event.getType() == Watcher.Event.EventType.None )
          {
-             newIsConnected = checkState(event.getState(), wasConnected);
+             boolean wasConnected = isConnected.get();
+             boolean newIsConnected = checkState(event.getState(), wasConnected);
+             if ( newIsConnected != wasConnected )
+             {
+                 isConnected.set(newIsConnected);
+                 connectionStartMs = System.currentTimeMillis();
++                if ( newIsConnected )
++                {
++                    lastNegotiatedSessionTimeoutMs.set(zooKeeper.getNegotiatedSessionTimeoutMs());
++                    log.debug("Negotiated session timeout: " + lastNegotiatedSessionTimeoutMs.get());
++                }
+             }
          }
  
-         if ( newIsConnected != wasConnected )
+         for ( Watcher parentWatcher : parentWatchers )
          {
-             isConnected.set(newIsConnected);
-             connectionStartMs = System.currentTimeMillis();
-             if ( newIsConnected )
-             {
-                 lastNegotiatedSessionTimeoutMs.set(zooKeeper.getNegotiatedSessionTimeoutMs());
-                 log.debug("Negotiated session timeout: " + lastNegotiatedSessionTimeoutMs.get());
-             }
+             TimeTrace timeTrace = new TimeTrace("connection-state-parent-process", tracer.get());
+             parentWatcher.process(event);
+             timeTrace.commit();
          }
      }
  

http://git-wip-us.apache.org/repos/asf/curator/blob/1bbf301a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestBlockUntilConnected.java
----------------------------------------------------------------------


Mime
View raw message