views:

148

answers:

1

I'm using a MXBean to instrument a certain feature, and I have a method that takes in 3 input arguments.

By default, on the jconsole, the arguments are displayed as p1, p2, p3 etc. I have @params describing each parameter. How do I make jConsole use those?

public class Sample implements SampleMXBean {

    /**
     * method 1
     *
     * @param input1 Input One
     * @param input2 Input Two
     */
     public void getInput(int input1, int input2) {
       ...
       ...
     }
}

I have registered the above MXBean , and when I launch, the panel for this operation, I get a button with "getInput" as the text, and 2 text boxes with names as p1 and p2, instead of "Input One" and "Input Two".

Are there any annotations that I need to use to achieve this? (Btw I'm using jdk1.6)

+1  A: 

Are you using Spring? They have a module that does what you're describing with @ManagedOperation and ManagedOperationParameter annotations. Otherwise, you're on your own to create the appropriate javax.management.modelmbean.ModelMBeanOperationInfo class when you're registering your object in JMX.

JSR-255 might address this in the future though. See this blog post

Kevin