diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java b/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java index 021da94c73..62ac019bab 100644 --- a/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java @@ -773,16 +773,10 @@ public class BrokerService implements Service, Serializable { } - protected void registerConnectorMBean(TransportConnector connector) throws IOException, URISyntaxException { + protected void registerConnectorMBean(TransportConnector connector, ObjectName objectName) throws IOException, URISyntaxException { MBeanServer mbeanServer = getManagementContext().getMBeanServer(); ConnectorViewMBean view = new ConnectorView(connector); try { - ObjectName objectName = new ObjectName( - managementContext.getJmxDomainName()+":"+ - "BrokerName="+JMXSupport.encodeObjectNamePart(getBrokerName())+","+ - "Type=Connector,"+ - "ConnectorName="+JMXSupport.encodeObjectNamePart(connector.getName()) - ); mbeanServer.registerMBean(view, objectName); registeredMBeanNames.add(objectName); } @@ -1088,8 +1082,16 @@ public class BrokerService implements Service, Serializable { } if (isUseJmx()) { - connector = connector.asManagedConnector(getManagementContext().getMBeanServer(), getBrokerObjectName()); - registerConnectorMBean(connector); + + ObjectName objectName = new ObjectName( + managementContext.getJmxDomainName()+":"+ + "BrokerName="+JMXSupport.encodeObjectNamePart(getBrokerName())+","+ + "Type=Connector,"+ + "ConnectorName="+JMXSupport.encodeObjectNamePart(connector.getName()) + ); + + connector = connector.asManagedConnector(getManagementContext().getMBeanServer(), objectName); + registerConnectorMBean(connector, objectName); } connector.start(); } diff --git a/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagedTransportConnection.java b/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagedTransportConnection.java index e3e44f9b61..34a3682e91 100644 --- a/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagedTransportConnection.java +++ b/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ManagedTransportConnection.java @@ -117,8 +117,9 @@ public class ManagedTransportConnection extends TransportConnection { try { return new ObjectName( connectorName.getDomain()+":"+ - "BrokerName="+map.get("BrokerName")+","+ + "BrokerName="+JMXSupport.encodeObjectNamePart((String) map.get("BrokerName"))+","+ "Type=Connection,"+ + "ConnectorName="+JMXSupport.encodeObjectNamePart((String) map.get("ConnectorName"))+","+ "Connection="+JMXSupport.encodeObjectNamePart(connectionId) ); }