I want to make my Standard MBean verbose in JBoss jmx-console. DynamicMBean has getMBeanInfo() to do it. Method return MBeanInfo with description of MBean. But how I can to do the same thing for Standard MBean? E.g. I have following MBean interface:
public interface MyMBean {
String f();
}
... with following implementation:
public class My implements MyMBean {
public String f() {
return "test";
}
}
What should be done to add description in such example?
Thanks
An MBean is a managed Java object, similar to a JavaBeans component, that follows the design patterns set forth in the JMX specification. An MBean can represent a device, an application, or any resource that needs to be managed.
The automatic registration of any Spring bean as a JMX MBean. A flexible mechanism for controlling the management interface of your beans. The declarative exposure of MBeans over remote, JSR-160 connectors.
The JMX specification defines the design patterns, APIs, services and architecture for application management, network management and monitoring in the Java programming language. The need to administer, monitor and manage a container is today recognized as a prerequisite in the enterprise software domain.
The JMX specification defines four types of MBean: standard MBeans, dynamic MBeans, open MBeans and model MBeans. The examples in this chapter demonstrate the simplest type of MBean, namely standard MBeans.
For StandardMBeans there is no way for adding description or other meta information.
From the JavaDoc of MBeanInfo
:
The remaining details of the MBeanInfo for a Standard MBean are not specified. This includes the description of the MBeanInfo and of any contained constructors, attributes, operations, and notifications; and the names and descriptions of parameters to constructors and operations.
So you need to use at least DynamicMBeans (or a ModelMBean or OpenMBean) for specifying this information. Spring can help you insofar as it allows the creation of DynamicMBeans via annotations, which at the end is even simpler to use than to write own StandardMBeans. Example (from the spring documentation) :
@ManagedResource(objectName="bean:name=testBean4",
description="My Managed Bean")
public class AnnotationTestBean {
private int age;
@ManagedAttribute(description="The Age Attribute", currencyTimeLimit=15)
public int getAge() {
return age;
}
}
See this article for details.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With