How to add description to the JMX Service Object's methods and parameters in JBoss?

StackOverflow https://stackoverflow.com/questions/10911706

  •  13-06-2021
  •  | 
  •  

Domanda

Is it possible to have a description showing up in the JMX console for my MBean's methods and paramenters.

Right now this is how I see my MBean in the JBoss JMX Console: enter image description here

Is there some annotation that can do that job for me?

Something like in the code snippet bellow (I just made the annotations up, not sure if they exist):

@Management
public interface InterestRateManager {
  @Description("Sets the interest rate")
  public void setInterestRate(@Description("The interest rate") double g);

  public double getInterestRate();
}

The end result would be to have the p1 have a meaningful name and to have the description.

Not super sure if this is relevant but I'm using JBoss 4.2.2 GA.

Thanks!

È stato utile?

Soluzione

Yup, it's possible. You have 2 primary options:

  1. Implement your MBean as a DynamicMBean. There's additional JBoss support for these through extending ServiceDynamicMBeanSupport.
  2. JBoss implements a model called an XMBean which is probably preferable if you're only targeting JBoss. Basically, you can convert your existing code to an XMBean by simply providing the additional meta-data in the form of XML which can be embedded in the deployment descriptor or referenced as an external resource. See this page on how to convert a standard mbean to an XMBean.
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top