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 2022/02/08 17:48:49 UTC

[geode] branch support/1.15 updated: GEODE-10009: Invoked internalClose with keepAlive true (#7332)

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

boglesby pushed a commit to branch support/1.15
in repository https://gitbox.apache.org/repos/asf/geode.git


The following commit(s) were added to refs/heads/support/1.15 by this push:
     new 05eba09  GEODE-10009: Invoked internalClose with keepAlive true (#7332)
05eba09 is described below

commit 05eba09d0f3881344b130dca226f5e8203d546d2
Author: Barry Oglesby <bo...@users.noreply.github.com>
AuthorDate: Mon Feb 7 15:03:51 2022 -1000

    GEODE-10009: Invoked internalClose with keepAlive true (#7332)
    
    
    (cherry picked from commit 551d7d78548f10218146b074df9b0c4adc0940f7)
---
 .../client/internal/QueueManagerJUnitTest.java     | 28 +++++++++++++++++++---
 .../cache/client/internal/QueueManagerImpl.java    |  2 +-
 2 files changed, 26 insertions(+), 4 deletions(-)

diff --git a/geode-core/src/integrationTest/java/org/apache/geode/cache/client/internal/QueueManagerJUnitTest.java b/geode-core/src/integrationTest/java/org/apache/geode/cache/client/internal/QueueManagerJUnitTest.java
index e2f8569..dbdd123 100644
--- a/geode-core/src/integrationTest/java/org/apache/geode/cache/client/internal/QueueManagerJUnitTest.java
+++ b/geode-core/src/integrationTest/java/org/apache/geode/cache/client/internal/QueueManagerJUnitTest.java
@@ -275,6 +275,25 @@ public class QueueManagerJUnitTest {
         .hasMessageContaining(serverRefusedConnectionExceptionMessage);
   }
 
+  @Test
+  public void testAddToConnectionListCallsCloseConnectionOpWithKeepAliveTrue2() {
+    // Create a DummyConnection
+    DummyConnection connection = factory.addConnection(0, 0, 1);
+    assertThat(connection.keepAlive).isFalse();
+
+    // Get and close its Endpoint
+    Endpoint endpoint = connection.getEndpoint();
+    endpoint.close();
+
+    // Create and start a QueueManagerImpl
+    manager = new QueueManagerImpl(pool, endpoints, source, factory, 2, 20, logger,
+        ClientProxyMembershipID.getNewProxyMembership(ds));
+    manager.start(background);
+
+    // Assert that the connection keepAlive is true
+    assertThat(connection.keepAlive).isTrue();
+  }
+
   private static void assertPortEquals(int expected, Connection actual) {
     assertThat(actual.getServer().getPort()).isEqualTo(expected);
   }
@@ -596,8 +615,10 @@ public class QueueManagerJUnitTest {
       nextConnections.add(null);
     }
 
-    private void addConnection(int endpointType, int queueSize, int port) {
-      nextConnections.add(new DummyConnection(endpointType, queueSize, port));
+    private DummyConnection addConnection(int endpointType, int queueSize, int port) {
+      DummyConnection connection = new DummyConnection(endpointType, queueSize, port);
+      nextConnections.add(connection);
+      return connection;
     }
 
     @Override
@@ -720,6 +741,7 @@ public class QueueManagerJUnitTest {
     private final ServerQueueStatus status;
     private final ServerLocation location;
     private final Endpoint endpoint;
+    private boolean keepAlive;
 
     private DummyConnection(int endpointType, int queueSize, int port) {
       InternalDistributedMember member = new InternalDistributedMember("localhost", 555);
@@ -730,7 +752,7 @@ public class QueueManagerJUnitTest {
 
     @Override
     public void close(boolean keepAlive) {
-      // nothing
+      this.keepAlive = keepAlive;
     }
 
     @Override
diff --git a/geode-core/src/main/java/org/apache/geode/cache/client/internal/QueueManagerImpl.java b/geode-core/src/main/java/org/apache/geode/cache/client/internal/QueueManagerImpl.java
index 2afddb8..28485c7 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/client/internal/QueueManagerImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/client/internal/QueueManagerImpl.java
@@ -1010,7 +1010,7 @@ public class QueueManagerImpl implements QueueManager {
             connection.getEndpoint());
       }
       try {
-        connection.internalClose(pool.getKeepAlive());
+        connection.internalClose(true);
       } catch (Exception e) {
         if (logger.isDebugEnabled()) {
           logger.debug("Error destroying client to server connection to {}",