[1/2] activemq-artemis git commit: This closes #2450

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[1/2] activemq-artemis git commit: This closes #2450

nigrofranz
Repository: activemq-artemis
Updated Branches:
  refs/heads/master e41a24af7 -> 986051a05


This closes #2450


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

Branch: refs/heads/master
Commit: 986051a05d8fb7643d2e50232c22ecf922266183
Parents: e41a24a 4ab7923
Author: Francesco Nigro <[hidden email]>
Authored: Fri Dec 14 11:37:57 2018 +0100
Committer: Francesco Nigro <[hidden email]>
Committed: Fri Dec 14 11:37:57 2018 +0100

----------------------------------------------------------------------
 .../artemis/jms/client/ActiveMQConnection.java  |  1 +
 .../jms/tests/TemporaryDestinationTest.java     | 47 ++++++++++++++++++++
 2 files changed, 48 insertions(+)
----------------------------------------------------------------------


Reply | Threaded
Open this post in threaded view
|

[2/2] activemq-artemis git commit: ARTEMIS-2190 core JMS client leaks temp dest names

nigrofranz
ARTEMIS-2190 core JMS client leaks temp dest names


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

Branch: refs/heads/master
Commit: 4ab7923a84230545b1f9eada0b9e595d5c94dc11
Parents: e41a24a
Author: Justin Bertram <[hidden email]>
Authored: Tue Dec 4 11:01:30 2018 -0600
Committer: Francesco Nigro <[hidden email]>
Committed: Fri Dec 14 11:37:57 2018 +0100

----------------------------------------------------------------------
 .../artemis/jms/client/ActiveMQConnection.java  |  1 +
 .../jms/tests/TemporaryDestinationTest.java     | 47 ++++++++++++++++++++
 2 files changed, 48 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/4ab7923a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQConnection.java
----------------------------------------------------------------------
diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQConnection.java b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQConnection.java
index eea238b..2300a54 100644
--- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQConnection.java
+++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQConnection.java
@@ -548,6 +548,7 @@ public class ActiveMQConnection extends ActiveMQConnectionForContextImpl impleme
 
    public void removeTemporaryQueue(final SimpleString queueAddress) {
       tempQueues.remove(queueAddress);
+      knownDestinations.remove(queueAddress);
    }
 
    public void addKnownDestination(final SimpleString address) {

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/4ab7923a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/TemporaryDestinationTest.java
----------------------------------------------------------------------
diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/TemporaryDestinationTest.java b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/TemporaryDestinationTest.java
index 2a4ad41..6b29aea 100644
--- a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/TemporaryDestinationTest.java
+++ b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/TemporaryDestinationTest.java
@@ -28,6 +28,8 @@ import javax.jms.TextMessage;
 import javax.naming.NamingException;
 
 import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
+import org.apache.activemq.artemis.api.core.SimpleString;
+import org.apache.activemq.artemis.jms.client.ActiveMQConnection;
 import org.apache.activemq.artemis.jms.tests.util.ProxyAssertSupport;
 import org.junit.Test;
 
@@ -127,6 +129,51 @@ public class TemporaryDestinationTest extends JMSTestCase {
       }
    }
 
+   @Test
+   public void testTemporaryQueueLeak() throws Exception {
+      ActiveMQConnection conn = null;
+
+      try {
+         conn = (ActiveMQConnection) createConnection();
+
+         Session producerSession = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+         Session consumerSession = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+         TemporaryQueue tempQueue = producerSession.createTemporaryQueue();
+
+         MessageProducer producer = producerSession.createProducer(tempQueue);
+
+         MessageConsumer consumer = consumerSession.createConsumer(tempQueue);
+
+         conn.start();
+
+         final String messageText = "This is a message";
+
+         Message m = producerSession.createTextMessage(messageText);
+
+         producer.send(m);
+
+         TextMessage m2 = (TextMessage) consumer.receive(2000);
+
+         ProxyAssertSupport.assertNotNull(m2);
+
+         ProxyAssertSupport.assertEquals(messageText, m2.getText());
+
+         consumer.close();
+
+         tempQueue.delete();
+
+         ProxyAssertSupport.assertFalse(conn.containsKnownDestination(SimpleString.toSimpleString(tempQueue.getQueueName())));
+
+         ProxyAssertSupport.assertFalse(conn.containsTemporaryQueue(SimpleString.toSimpleString(tempQueue.getQueueName())));
+      } finally {
+         if (conn != null) {
+            conn.close();
+         }
+      }
+   }
+
    /**
     * http://jira.jboss.com/jira/browse/JBMESSAGING-93
     */