You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by gt...@apache.org on 2013/01/10 13:33:56 UTC

svn commit: r1431319 - in /activemq/trunk: activemq-broker/src/main/java/org/apache/activemq/broker/jmx/ManagedTransportConnection.java activemq-core/src/test/java/org/apache/activemq/broker/jmx/TransportConnectorMBeanTest.java

Author: gtully
Date: Thu Jan 10 12:33:56 2013
New Revision: 1431319

URL: http://svn.apache.org/viewvc?rev=1431319&view=rev
Log:
https://issues.apache.org/jira/browse/AMQ-3438 - update so we only register a conneciton mbean once, default by remote address or by client id - ManagementContext#allowRemoteAddressInMBeanNames=false (once connectionInfo is received)

Modified:
    activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/ManagedTransportConnection.java
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/jmx/TransportConnectorMBeanTest.java

Modified: activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/ManagedTransportConnection.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/ManagedTransportConnection.java?rev=1431319&r1=1431318&r2=1431319&view=diff
==============================================================================
--- activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/ManagedTransportConnection.java (original)
+++ activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/ManagedTransportConnection.java Thu Jan 10 12:33:56 2013
@@ -81,10 +81,12 @@ public class ManagedTransportConnection 
         if (populateUserName) {
             ((ConnectionView) mbean).setUserName(info.getUserName());
         }
-        if (clientId != null) {
-            if (byClientIdName == null) {
-                byClientIdName = createByClientIdObjectName(clientId);
-                registerMBean(byClientIdName);
+        if (!managementContext.isAllowRemoteAddressInMBeanNames()) {
+            if (clientId != null) {
+                if (byClientIdName == null) {
+                    byClientIdName = createByClientIdObjectName(clientId);
+                    registerMBean(byClientIdName);
+                }
             }
         }
         return answer;

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/jmx/TransportConnectorMBeanTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/jmx/TransportConnectorMBeanTest.java?rev=1431319&r1=1431318&r2=1431319&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/jmx/TransportConnectorMBeanTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/jmx/TransportConnectorMBeanTest.java Thu Jan 10 12:33:56 2013
@@ -50,7 +50,7 @@ public class TransportConnectorMBeanTest
         createBroker(allowRemoteAddress);
         ActiveMQConnection connection = createConnection();
         Set<ObjectName> registeredMbeans = getRegisteredMbeans();
-        assertTrue("found mbean with clientId", match(connection.getClientID(), registeredMbeans));
+        assertEquals("presence of mbean with clientId", !allowRemoteAddress, match(connection.getClientID(), registeredMbeans));
         assertEquals("presence of mbean with local port", allowRemoteAddress, match(extractLocalPort(connection), registeredMbeans));
     }
 
@@ -84,8 +84,9 @@ public class TransportConnectorMBeanTest
     }
 
     private ActiveMQConnection createConnection() throws Exception {
+        final String opts = "?jms.watchTopicAdvisories=false";
         ActiveMQConnection connection = (ActiveMQConnection)
-                new ActiveMQConnectionFactory(broker.getTransportConnectors().get(0).getConnectUri()).createConnection();
+                new ActiveMQConnectionFactory(broker.getTransportConnectors().get(0).getConnectUri() + opts).createConnection();
         connection.start();
         return connection;
     }