This is an automated email from the ASF dual-hosted git repository.

upthewaterspout pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode.git


The following commit(s) were added to refs/heads/develop by this push:
     new e9ada48  GEODE-3523: Update locatorDiscoveryCallback after updating 
state
e9ada48 is described below

commit e9ada484eb671498e76698ef34b0b1d6fd28184b
Author: Dan Smith <dsm...@pivotal.io>
AuthorDate: Thu Feb 22 13:32:24 2018 -0800

    GEODE-3523: Update locatorDiscoveryCallback after updating state
    
    Some tests wait for this callback to be notified of new locators before
    killing old locators. But The callback is called before the internal
    state on the client is updated. So there was a race condition where the
    test would know about the new locator, but the client code itself would
    not use it yet.
---
 .../cache/client/internal/AutoConnectionSourceImpl.java     | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git 
a/geode-core/src/main/java/org/apache/geode/cache/client/internal/AutoConnectionSourceImpl.java
 
b/geode-core/src/main/java/org/apache/geode/cache/client/internal/AutoConnectionSourceImpl.java
index 244e197..2143ee7 100644
--- 
a/geode-core/src/main/java/org/apache/geode/cache/client/internal/AutoConnectionSourceImpl.java
+++ 
b/geode-core/src/main/java/org/apache/geode/cache/client/internal/AutoConnectionSourceImpl.java
@@ -319,9 +319,13 @@ public class AutoConnectionSourceImpl implements 
ConnectionSource {
 
     LocatorList newLocatorList = new LocatorList(newLocatorAddresses);
 
-    if (logger.isInfoEnabled()) {
+    LocatorList oldLocators = locators.getAndSet(newLocatorList);
+    onlineLocators.set(new LocatorList(newOnlineLocators));
+    pool.getStats().setLocatorCount(newLocatorAddresses.size());
+
+    if (logger.isInfoEnabled()
+        || 
!locatorCallback.getClass().equals(LocatorDiscoveryCallbackAdapter.class)) {
       List<InetSocketAddress> newLocators = newLocatorList.getLocators();
-      LocatorList oldLocators = (LocatorList) locators.get();
       ArrayList<InetSocketAddress> removedLocators =
           new ArrayList<InetSocketAddress>(oldLocators.getLocators());
       removedLocators.removeAll(newLocators);
@@ -342,11 +346,6 @@ public class AutoConnectionSourceImpl implements 
ConnectionSource {
       }
     }
 
-
-
-    locators.set(newLocatorList);
-    onlineLocators.set(new LocatorList(newOnlineLocators));
-    pool.getStats().setLocatorCount(newLocatorAddresses.size());
   }
 
   /**

-- 
To stop receiving notification emails like this one, please contact
upthewatersp...@apache.org.

Reply via email to