activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gtu...@apache.org
Subject activemq git commit: https://issues.apache.org/jira/browse/AMQ-6068 - fix and test. Cleanup from ra managed connection needs to remove the connection info, leaving the tcp connection free for another identity. Possibly this could be conditional on having
Date Tue, 01 Dec 2015 14:29:20 GMT
Repository: activemq
Updated Branches:
  refs/heads/master 144b711a9 -> 5a27bdf07


https://issues.apache.org/jira/browse/AMQ-6068 - fix and test. Cleanup from ra managed connection
needs to remove the connection info, leaving the tcp connection free for another identity.
Possibly this could be conditional on having a user supplied clientId


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

Branch: refs/heads/master
Commit: 5a27bdf07e1cc77251d02d10b477b38d34413d91
Parents: 144b711
Author: gtully <gary.tully@gmail.com>
Authored: Tue Dec 1 14:28:07 2015 +0000
Committer: gtully <gary.tully@gmail.com>
Committed: Tue Dec 1 14:28:07 2015 +0000

----------------------------------------------------------------------
 .../activemq/ra/ActiveMQManagedConnection.java  |  2 +-
 .../activemq/ra/ConnectionManagerAdapter.java   |  6 +--
 .../activemq/ra/ManagedConnectionTest.java      | 39 ++++++++++++++++++++
 3 files changed, 41 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/5a27bdf0/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQManagedConnection.java
----------------------------------------------------------------------
diff --git a/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQManagedConnection.java
b/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQManagedConnection.java
index 45e7028..85c947c 100755
--- a/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQManagedConnection.java
+++ b/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQManagedConnection.java
@@ -232,7 +232,7 @@ public class ActiveMQManagedConnection implements ManagedConnection, ExceptionLi
         proxyConnections.clear();
 
         try {
-            physicalConnection.cleanup();
+            physicalConnection.doCleanup(true);
         } catch (JMSException e) {
             throw new ResourceException("Could not cleanup the ActiveMQ connection: " + e,
e);
         } finally {

http://git-wip-us.apache.org/repos/asf/activemq/blob/5a27bdf0/activemq-ra/src/test/java/org/apache/activemq/ra/ConnectionManagerAdapter.java
----------------------------------------------------------------------
diff --git a/activemq-ra/src/test/java/org/apache/activemq/ra/ConnectionManagerAdapter.java
b/activemq-ra/src/test/java/org/apache/activemq/ra/ConnectionManagerAdapter.java
index 9520c2a..278bf9c 100755
--- a/activemq-ra/src/test/java/org/apache/activemq/ra/ConnectionManagerAdapter.java
+++ b/activemq-ra/src/test/java/org/apache/activemq/ra/ConnectionManagerAdapter.java
@@ -86,11 +86,7 @@ public class ConnectionManagerAdapter implements ConnectionManager, ConnectionEv
             LOG.warn("Error occured during the cleanup of a managed connection: ", e);
         }
 
-        try {
-            ((ManagedConnection)event.getSource()).destroy();
-        } catch (ResourceException e) {
-            LOG.warn("Error occured during the destruction of a managed connection: ", e);
-        }
+        // should go back in a pool, no destroy
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/activemq/blob/5a27bdf0/activemq-ra/src/test/java/org/apache/activemq/ra/ManagedConnectionTest.java
----------------------------------------------------------------------
diff --git a/activemq-ra/src/test/java/org/apache/activemq/ra/ManagedConnectionTest.java b/activemq-ra/src/test/java/org/apache/activemq/ra/ManagedConnectionTest.java
index 6dbe864..2d1e10a 100755
--- a/activemq-ra/src/test/java/org/apache/activemq/ra/ManagedConnectionTest.java
+++ b/activemq-ra/src/test/java/org/apache/activemq/ra/ManagedConnectionTest.java
@@ -33,7 +33,9 @@ import javax.jms.TopicConnectionFactory;
 import javax.resource.ResourceException;
 import javax.resource.spi.ConnectionEvent;
 
+import org.apache.activemq.ActiveMQConnection;
 import org.apache.activemq.ActiveMQConnectionFactory;
+import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -61,6 +63,13 @@ public class ManagedConnectionTest {
 
     }
 
+    @After
+    public void destroyManagedConnection() throws Exception {
+        if (managedConnection != null) {
+            managedConnection.destroy();
+        }
+    }
+
     @Test(timeout = 60000)
     public void testConnectionCloseEvent() throws ResourceException, JMSException {
 
@@ -161,6 +170,36 @@ public class ManagedConnectionTest {
     }
 
     @Test(timeout = 60000)
+    public void testSetClientIdAfterCleanup() throws Exception {
+
+        connection.setClientID("test");
+        try {
+            connection.setClientID("test");
+            fail("Should have received JMSException");
+        } catch (JMSException e) {
+        }
+
+        ActiveMQConnection physicalConnection = (ActiveMQConnection) managedConnection.getPhysicalConnection();
+        try {
+            physicalConnection.setClientID("testTwo");
+            fail("Should have received JMSException");
+        } catch (JMSException e) {
+        }
+
+        // close the proxy
+        connection.close();
+
+        // can set the id on the physical connection again after cleanup
+        physicalConnection.setClientID("test3");
+
+        try {
+            physicalConnection.setClientID("test4");
+            fail("Should have received JMSException");
+        } catch (JMSException e) {
+        }
+    }
+
+    @Test(timeout = 60000)
     public void testSessionCloseIndependance() throws ResourceException, JMSException {
 
         Session session1 = connection.createSession(true, 0);


Mime
View raw message