Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Description for Standard MBean

Tags:

java

jboss

jmx

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

like image 772
Raman Avatar asked Mar 10 '11 10:03

Raman


People also ask

What is JMX MBean?

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.

What is spring boot MBean?

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.

What is JMX specification?

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.

How many types of MBeans are there in JMX?

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.


1 Answers

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.

like image 198
Roland Huß Avatar answered Oct 03 '22 04:10

Roland Huß