activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject [1/3] activemq-artemis git commit: ARTEMIS-1935: Close of openwire connection should closes all open sessions
Date Fri, 15 Jun 2018 14:42:37 GMT
Repository: activemq-artemis
Updated Branches:
  refs/heads/master f52fefb42 -> 13954d350


ARTEMIS-1935: Close of openwire connection should closes all open sessions

This is my ammending to the last commit
I'm adding some extra verifications to the test
and I fixed a leak that already existed on the previous map


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/b360fa60
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/b360fa60
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/b360fa60

Branch: refs/heads/master
Commit: b360fa6063b4060ad91a478d3b46dba557d9a72b
Parents: 3987115
Author: Clebert Suconic <clebertsuconic@apache.org>
Authored: Fri Jun 15 10:32:39 2018 -0400
Committer: Clebert Suconic <clebertsuconic@apache.org>
Committed: Fri Jun 15 10:33:55 2018 -0400

----------------------------------------------------------------------
 .../protocol/openwire/OpenWireConnection.java   |  1 +
 .../openwire/SessionHandlingOpenWireTest.java   | 22 ++++++++++++++------
 2 files changed, 17 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b360fa60/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
index bafce92..b5adf34 100644
--- a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
+++ b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
@@ -1013,6 +1013,7 @@ public class OpenWireConnection extends AbstractRemotingConnection implements
Se
    public void removeSession(AMQConnectionContext context, SessionInfo info) throws Exception
{
       AMQSession session = sessions.remove(info.getSessionId());
       if (session != null) {
+         sessionIdMap.remove(session.getCoreSession().getName());
          session.close();
       }
    }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b360fa60/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/SessionHandlingOpenWireTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/SessionHandlingOpenWireTest.java
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/SessionHandlingOpenWireTest.java
index 989b62d..c43d5f7 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/SessionHandlingOpenWireTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/SessionHandlingOpenWireTest.java
@@ -61,12 +61,22 @@ public class SessionHandlingOpenWireTest extends BasicOpenWireTest {
    public void testInternalSessionHandlingNoSessionClose() throws Exception {
       try (Connection conn = factory.createConnection()) {
          conn.start();
-         Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-         Destination dest = createDestination(session,ActiveMQDestination.QUEUE_TYPE);
-         sendMessages(session, dest, 1);
-         MessageConsumer consumer = session.createConsumer(dest);
-         Message m = consumer.receive(2000);
-         assertNotNull(m);
+         for (int i = 0; i < 100; i++) {
+            Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+            Destination dest = createDestination(session,ActiveMQDestination.QUEUE_TYPE);
+            sendMessages(session, dest, 1);
+            MessageConsumer consumer = session.createConsumer(dest);
+            Message m = consumer.receive(2000);
+            consumer.close();
+            assertNotNull(m);
+
+            if (i % 2 == 1) {
+               // it will close only half of the sessions
+               // just to introduce error conditions
+               session.close();
+            }
+
+         }
       }
       assertFalse(AssertionLoggerHandler.findText("Client connection failed, clearing up
resources for session"));
       assertFalse(AssertionLoggerHandler.findText("Cleared up resources for session"));


Mime
View raw message