You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by bo...@apache.org on 2019/01/28 18:41:44 UTC

[geode] branch feature/GEODE-6287 updated: GEODE-6287: Modified test to wait for CacheClientProxy to be closed

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

boglesby pushed a commit to branch feature/GEODE-6287
in repository https://gitbox.apache.org/repos/asf/geode.git


The following commit(s) were added to refs/heads/feature/GEODE-6287 by this push:
     new 94b7ab6  GEODE-6287: Modified test to wait for CacheClientProxy to be closed
94b7ab6 is described below

commit 94b7ab6fb72056641c89d48df70fe42b93cad293
Author: Barry Oglesby <bo...@pivotal.io>
AuthorDate: Mon Jan 28 10:41:22 2019 -0800

    GEODE-6287: Modified test to wait for CacheClientProxy to be closed
---
 ...ientServerConnectDisconnectDistributedTest.java | 25 ++++++++++++++++++----
 .../apache/geode/internal/cache/FilterProfile.java |  3 +++
 2 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/tier/sockets/ClientServerConnectDisconnectDistributedTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/tier/sockets/ClientServerConnectDisconnectDistributedTest.java
index 4b45629..222b1f0 100644
--- a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/tier/sockets/ClientServerConnectDisconnectDistributedTest.java
+++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/tier/sockets/ClientServerConnectDisconnectDistributedTest.java
@@ -122,6 +122,9 @@ public class ClientServerConnectDisconnectDistributedTest implements Serializabl
       ClusterStartupRule.getClientCache().close();
     });
 
+    // Wait for CacheClientProxy to be closed
+    server.invoke(() -> waitForCacheClientProxyToBeClosed());
+
     // Verify proxy id is unregistered from filter profile
     server.invoke(() -> verifyRealAndWireProxyIdsInFilterProfile(regionName, 0));
   }
@@ -175,17 +178,25 @@ public class ClientServerConnectDisconnectDistributedTest implements Serializabl
   private void verifySubjectsAreLoggedOut() {
     AcceptorImpl acceptor = getAcceptor();
 
+    // Wait for ServerConnections to be closed
+    waitForServerConnectionsToBeClosed(acceptor);
+
     // Verify ServerConnection subjects are logged out
-    verifyServerConnectionSubjectsAreLoggedOut(acceptor);
+    verifyServerConnectionSubjectsAreLoggedOut();
+
+    // Wait for CacheClientProxy to be closed
+    waitForCacheClientProxyToBeClosed(acceptor);
 
     // Verify the CacheClientProxy subject is logged out
-    verifyCacheClientProxyIsLoggedOut(acceptor);
+    verifyCacheClientProxyIsLoggedOut();
   }
 
-  private void verifyServerConnectionSubjectsAreLoggedOut(AcceptorImpl acceptor) {
+  private void waitForServerConnectionsToBeClosed(AcceptorImpl acceptor) {
     // Wait for all ServerConnections to be closed since handleTermination is in the finally block
     await().until(() -> acceptor.getAllServerConnections().isEmpty());
+  }
 
+  private void verifyServerConnectionSubjectsAreLoggedOut() {
     for (Subject subject : serverConnectionSubjects) {
       assertThat(subject.getPrincipal()).isNull();
       assertThat(subject.getPrincipals()).isNull();
@@ -197,15 +208,21 @@ public class ClientServerConnectDisconnectDistributedTest implements Serializabl
     }
   }
 
-  private void verifyCacheClientProxyIsLoggedOut(AcceptorImpl acceptor) {
+  private void waitForCacheClientProxyToBeClosed(AcceptorImpl acceptor) {
     // Wait for the CacheClientProxy to be closed since handleTermination is in the finally block
     await().until(() -> acceptor.getCacheClientNotifier().getClientProxies().isEmpty());
+  }
 
+  private void verifyCacheClientProxyIsLoggedOut() {
     assertThat(proxySubject.getPrincipal()).isNull();
     assertThat(proxySubject.getPrincipals()).isNull();
     assertThat(proxySubject.isAuthenticated()).isFalse();
   }
 
+  private void waitForCacheClientProxyToBeClosed() {
+    waitForCacheClientProxyToBeClosed(getAcceptor());
+  }
+
   private void verifyRealAndWireProxyIdsInFilterProfile(String regionName, int expectedNumIds) {
     // Get filter profile
     Cache cache = ClusterStartupRule.getCache();
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/FilterProfile.java b/geode-core/src/main/java/org/apache/geode/internal/cache/FilterProfile.java
index 51e5210..afe292d 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/FilterProfile.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/FilterProfile.java
@@ -2050,6 +2050,7 @@ public class FilterProfile implements DataSerializableFixedID {
               this.hasLongID = true;
             }
             result = nextID++;
+            logger.warn("XXX IDMap.getWireID about to put realId=" + realId, new Exception());
             this.realIDs.put(realId, result);
             this.wireIDs.put(result, realId);
           }
@@ -2104,6 +2105,8 @@ public class FilterProfile implements DataSerializableFixedID {
      * remove the mapping for the given proxy ID
      */
     void removeIDMapping(Object clientId) {
+      logger.warn("XXX IDMap.removeIDMapping about to remove clientId=" + clientId,
+          new Exception());
       Long mappedId = this.realIDs.remove(clientId);
       if (mappedId != null) {
         this.wireIDs.remove(mappedId);