如何更改使用 MXBean 定义的操作显示的输入描述

发布于 2024-07-13 02:07:35 字数 553 浏览 4 评论 0原文

我正在使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

假装不在乎 2024-07-20 02:07:36

你用的是Spring吗? 他们有一个 模块 可以完成您的任务使用@ManagedOperationManagedOperationParameter注释进行描述。 否则,当您在 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文