如何更改使用 MXBean 定义的操作显示的输入描述
我正在使用 MXBean 来检测某个功能,并且我有一个接受 3 个输入参数的方法。
默认情况下,在 jconsole 上,参数显示为 p1、p2、p3 等。我有 @params 描述每个参数。 我如何让 jConsole 使用这些?
public class Sample implements SampleMXBean {
/**
* method 1
*
* @param input1 Input One
* @param input2 Input Two
*/
public void getInput(int input1, int input2) {
...
...
}
}
我已经注册了上面的 MXBean ,当我启动此操作的面板时,我得到一个以“getInput”作为文本的按钮,以及两个名称为 p1 和 p2 的文本框,而不是“Input One”和“Input二”。
我需要使用任何注释来实现此目的吗? (顺便说一句,我使用的是jdk1.6)
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)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你用的是Spring吗? 他们有一个 模块 可以完成您的任务使用@ManagedOperation和ManagedOperationParameter注释进行描述。 否则,当您在 JMX 中注册对象时,您需要自己创建适当的 javax.management.modelmbean.ModelMBeanOperationInfo 类。
JSR-255 将来可能会解决这个问题。 请参阅此博文
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