mirror of
https://github.com/apache/activemq.git
synced 2025-02-28 05:09:07 +00:00
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@812139 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
9b305d669b
commit
c1051c8ee1
@ -905,6 +905,23 @@ public class BrokerService implements Service {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Map<String, String> getTransportConnectorURIsAsMap() {
|
||||||
|
Map<String, String> answer = new HashMap<String, String>();
|
||||||
|
for (TransportConnector connector : transportConnectors) {
|
||||||
|
try {
|
||||||
|
URI uri = connector.getConnectUri();
|
||||||
|
String scheme = uri.getScheme();
|
||||||
|
if (scheme != null) {
|
||||||
|
answer.put(scheme.toLowerCase(), uri.toString());
|
||||||
|
System.err.println(scheme + " = " + uri);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOG.debug("Failed to read URI to build transportURIsAsMap", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return answer;
|
||||||
|
}
|
||||||
|
|
||||||
public String[] getTransportConnectorURIs() {
|
public String[] getTransportConnectorURIs() {
|
||||||
return transportConnectorURIs;
|
return transportConnectorURIs;
|
||||||
}
|
}
|
||||||
@ -1958,4 +1975,6 @@ public class BrokerService implements Service {
|
|||||||
public CountDownLatch getSlaveStartSignal() {
|
public CountDownLatch getSlaveStartSignal() {
|
||||||
return slaveStartSignal;
|
return slaveStartSignal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
@ -18,6 +18,7 @@ package org.apache.activemq.broker.jmx;
|
|||||||
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
import java.net.URI;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
@ -319,4 +320,30 @@ public class BrokerView implements BrokerViewMBean {
|
|||||||
throw e.getTargetException();
|
throw e.getTargetException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getOpenWireURL() {
|
||||||
|
String answer = brokerService.getTransportConnectorURIsAsMap().get("tcp");
|
||||||
|
return answer != null ? answer : "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStompURL() {
|
||||||
|
String answer = brokerService.getTransportConnectorURIsAsMap().get("stomp");
|
||||||
|
return answer != null ? answer : "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSslURL() {
|
||||||
|
String answer = brokerService.getTransportConnectorURIsAsMap().get("ssl");
|
||||||
|
return answer != null ? answer : "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStompSslURL() {
|
||||||
|
String answer = brokerService.getTransportConnectorURIsAsMap().get("stomp+ssl");
|
||||||
|
return answer != null ? answer : "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getVMURL() {
|
||||||
|
URI answer = brokerService.getVmConnectorURI();
|
||||||
|
return answer != null ? answer.toString() : "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -223,4 +223,19 @@ public interface BrokerViewMBean extends Service {
|
|||||||
@MBeanInfo(value="Reloads log4j.properties from the classpath.")
|
@MBeanInfo(value="Reloads log4j.properties from the classpath.")
|
||||||
public void reloadLog4jProperties() throws Throwable;
|
public void reloadLog4jProperties() throws Throwable;
|
||||||
|
|
||||||
|
@MBeanInfo("The url of the openwire connector")
|
||||||
|
String getOpenWireURL();
|
||||||
|
|
||||||
|
@MBeanInfo("The url of the stomp connector")
|
||||||
|
String getStompURL();
|
||||||
|
|
||||||
|
@MBeanInfo("The url of the SSL connector")
|
||||||
|
String getSslURL();
|
||||||
|
|
||||||
|
@MBeanInfo("The url of the Stomp SSL connector")
|
||||||
|
String getStompSslURL();
|
||||||
|
|
||||||
|
@MBeanInfo("The url of the VM connector")
|
||||||
|
String getVMURL();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -72,6 +72,13 @@ public class MBeanTest extends EmbeddedBrokerTestSupport {
|
|||||||
TestRunner.run(MBeanTest.class);
|
TestRunner.run(MBeanTest.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testConnectors() throws Exception{
|
||||||
|
ObjectName brokerName = assertRegisteredObjectName(domain + ":Type=Broker,BrokerName=localhost");
|
||||||
|
BrokerViewMBean broker = (BrokerViewMBean)MBeanServerInvocationHandler.newProxyInstance(mbeanServer, brokerName, BrokerViewMBean.class, true);
|
||||||
|
assertEquals("openwire URL doesn't equal bind Address",broker.getOpenWireURL(),this.bindAddress);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public void testMBeans() throws Exception {
|
public void testMBeans() throws Exception {
|
||||||
connection = connectionFactory.createConnection();
|
connection = connectionFactory.createConnection();
|
||||||
useConnection(connection);
|
useConnection(connection);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user