made minor update to the StatusView mbean to comply with these health mbean conventions https://github.com/hawtio/hawtio/blob/master/doc/HealthMBeans.md#health-mbeans

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1420092 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
James Strachan 2012-12-11 10:56:19 +00:00
parent 4531001b23
commit 1797ce98e3
3 changed files with 6 additions and 6 deletions

View File

@ -2079,7 +2079,7 @@ public class BrokerService implements Service {
try { try {
ObjectName objectName = new ObjectName(getManagementContext().getJmxDomainName() + ":" ObjectName objectName = new ObjectName(getManagementContext().getJmxDomainName() + ":"
+ "BrokerName=" + JMXSupport.encodeObjectNamePart(getBrokerName()) + "," + "BrokerName=" + JMXSupport.encodeObjectNamePart(getBrokerName()) + ","
+ "Type=Status"); + "Type=Health");
AnnotatedMBean.registerMBean(getManagementContext(), statusView, objectName); AnnotatedMBean.registerMBean(getManagementContext(), statusView, objectName);
} catch (Throwable e) { } catch (Throwable e) {

View File

@ -35,13 +35,13 @@ public class StatusView implements StatusViewMBean {
} }
@Override @Override
public TabularData status() throws Exception { public TabularData health() throws Exception {
OpenTypeSupport.OpenTypeFactory factory = OpenTypeSupport.getFactory(StatusEvent.class); OpenTypeSupport.OpenTypeFactory factory = OpenTypeSupport.getFactory(StatusEvent.class);
CompositeType ct = factory.getCompositeType(); CompositeType ct = factory.getCompositeType();
TabularType tt = new TabularType("Status", "Status", ct, new String[]{"id", "resource"}); TabularType tt = new TabularType("Status", "Status", ct, new String[]{"id", "resource"});
TabularDataSupport rc = new TabularDataSupport(tt); TabularDataSupport rc = new TabularDataSupport(tt);
List<StatusEvent> list = statusList(); List<StatusEvent> list = healthList();
for (StatusEvent statusEvent : list) { for (StatusEvent statusEvent : list) {
rc.put(new CompositeDataSupport(ct, factory.getFields(statusEvent))); rc.put(new CompositeDataSupport(ct, factory.getFields(statusEvent)));
} }
@ -49,7 +49,7 @@ public class StatusView implements StatusViewMBean {
} }
@Override @Override
public List<StatusEvent> statusList() throws Exception { public List<StatusEvent> healthList() throws Exception {
List<StatusEvent> answer = new ArrayList<StatusEvent>(); List<StatusEvent> answer = new ArrayList<StatusEvent>();
Map<ObjectName, DestinationView> queueViews = broker.getQueueViews(); Map<ObjectName, DestinationView> queueViews = broker.getQueueViews();
for (Map.Entry<ObjectName, DestinationView> entry : queueViews.entrySet()) { for (Map.Entry<ObjectName, DestinationView> entry : queueViews.entrySet()) {

View File

@ -24,7 +24,7 @@ import java.util.List;
*/ */
public interface StatusViewMBean { public interface StatusViewMBean {
public TabularData status() throws Exception; public TabularData health() throws Exception;
/** /**
* Warning this method can only be invoked if you have the correct version * Warning this method can only be invoked if you have the correct version
@ -33,5 +33,5 @@ public interface StatusViewMBean {
* *
* If in doubt, please use the {@link #status()} method instead! * If in doubt, please use the {@link #status()} method instead!
*/ */
List<StatusEvent> statusList() throws Exception; List<StatusEvent> healthList() throws Exception;
} }