geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n...@apache.org
Subject [geode] branch develop updated: GEODE-5270: Shutting down the AckThread (#2017)
Date Tue, 05 Jun 2018 22:53:17 GMT
This is an automated email from the ASF dual-hosted git repository.

nnag 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 d0ec4e4  GEODE-5270: Shutting down the AckThread (#2017)
d0ec4e4 is described below

commit d0ec4e455ed37e778b4cdd7c203d75a0e4ac29d2
Author: Nabarun Nag <nabarunnag@users.noreply.github.com>
AuthorDate: Tue Jun 5 15:53:13 2018 -0700

    GEODE-5270: Shutting down the AckThread (#2017)
    
    * Shutting down the ack thread reader
    	* If the ack thread reader is up and running and ends up reading the close messages response
that the stomper thread is trying to send out in the same connection
    	* This may result in two threads reading from the same connection and end up with OOME
    
    Co-authored-by: bijukunjummen <biju.kunjummen@gmail.com>
---
 .../cache/wan/GatewaySenderEventRemoteDispatcher.java      |  3 ++-
 .../wan/GatewaySenderEventRemoteDispatcherJUnitTest.java   | 14 ++++++++++++++
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/GatewaySenderEventRemoteDispatcher.java
b/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/GatewaySenderEventRemoteDispatcher.java
index 8ae7fb0..d6bbc9d 100644
--- a/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/GatewaySenderEventRemoteDispatcher.java
+++ b/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/GatewaySenderEventRemoteDispatcher.java
@@ -790,7 +790,7 @@ public class GatewaySenderEventRemoteDispatcher implements GatewaySenderEventDis
       }
     }
 
-    private void shutDownAckReaderConnection(Connection connection) {
+    protected void shutDownAckReaderConnection(Connection connection) {
       Connection conn = connection;
       // attempt to unblock the ackReader thread by shutting down the inputStream, if it
was stuck
       // on a read
@@ -825,6 +825,7 @@ public class GatewaySenderEventRemoteDispatcher implements GatewaySenderEventDis
   public void shutDownAckReaderConnection() {
     if (ackReaderThread != null) {
       ackReaderThread.shutDownAckReaderConnection(connection);
+      ackReaderThread.shutdown();
     }
   }
 
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/GatewaySenderEventRemoteDispatcherJUnitTest.java
b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/GatewaySenderEventRemoteDispatcherJUnitTest.java
index cb34e88..2d5b039 100644
--- a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/GatewaySenderEventRemoteDispatcherJUnitTest.java
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/GatewaySenderEventRemoteDispatcherJUnitTest.java
@@ -43,4 +43,18 @@ public class GatewaySenderEventRemoteDispatcherJUnitTest {
     assertNull(dispatcher.getConnection(false));
     assertTrue(ackReaderThread.isShutdown());
   }
+
+  @Test
+  public void shuttingDownAckThreadReaderConnectionShouldshutdownTheAckThreadReader() {
+    AbstractGatewaySender sender = mock(AbstractGatewaySender.class);
+    AbstractGatewaySenderEventProcessor eventProcessor =
+        mock(AbstractGatewaySenderEventProcessor.class);
+    GatewaySenderEventRemoteDispatcher dispatcher =
+        new GatewaySenderEventRemoteDispatcher(eventProcessor, null);
+    GatewaySenderEventRemoteDispatcher.AckReaderThread ackReaderThread =
+        dispatcher.new AckReaderThread(sender, "AckReaderThread");
+    dispatcher.setAckReaderThread(ackReaderThread);
+    dispatcher.shutDownAckReaderConnection();
+    assertTrue(ackReaderThread.isShutdown());
+  }
 }

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

Mime
View raw message