如何为MBean方法添加描述以在JBOSS的jmx-console中查看 [英] How to add description for MBean method to see it in jmx-console of JBOSS

查看:12
本文介绍了如何为MBean方法添加描述以在JBOSS的jmx-console中查看的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是 JBoss 4.3.2.GA

I'm using JBoss 4.3.2.GA

我已经向我的 MBean 服务添加了方法.方法在签名中有几个参数.它工作正常,但我想要更多.

I've added method to my MBean service. Method has several arguments in signature. It works fine but I want more.

问题:当我在 jmx-console 中看到方法签名时,我不知道每个输入字段的含义,因为 jmx-console 不显示参数名称,只显示值的输入字段.

Problem: when I see method signature in jmx-console, I don't know what every of this input fields means, because jmx-console doesn't show arguments names, only input fields for values.

是否可以添加每个参数的描述(在 Java 代码中,而不是 xml 中)允许在 JBOSS 的 jmx-console 中显示此描述?

Is there ability add description of every argument (in Java code, not xml) allowing to show this description in jmx-console of JBOSS?

我尝试使用 Spring 注解:@ManagedOperation 至少添加方法描述但没有结果(描述未在 jmx-console 中显示).

I've tried to use Spring annotation: @ManagedOperation to add at least method description but no results (description is not showed in jmx-console).

可能有人已经解决了这样的问题...

May be some one have resolved such issue...

推荐答案

在 Java 中,如果您不使用标准 MBean,您可以这样做,但是例如DynamicMBean 您需要为其实现 getMBeanInfo() 以返回所有数据.这是一种通用方式,不限于 JBoss.但这也需要大量工作,只有当您确实需要 DynamicMBean 的动态特性时,这 (IMO) 才有意义.

In Java, you can do this, if you don't use standard MBeans, but e.g. DynamicMBeans for which you need to implement getMBeanInfo() which is returning all that data. This is a generic way, not limited to JBoss. But it is also a lot of work, which (IMO) only makes sense if you really need the dynamic features of a DynamicMBean.

为了完整起见(因为这可能是更简单的方法):

For completeness sake (and as this may be the easier approach):

您可以编写一个 xmbean-descriptor 并将其放在例如进入 $SERVER/conf/xmdesc/除此之外,您还需要像这样增强标准 MBeean-descriptor(注意 xmbean-dd 属性:

You can write an xmbean-descriptor and put that e.g. into $SERVER/conf/xmdesc/ In addition to this you need to enhance the standard MBeean-descriptor like this (note the xmbean-dd attribute:

<mbean code="org.jnp.server.NamingBeanImpl"
   name="jboss:service=NamingBeanImpl"
   xmbean-dd="resource:xmdesc/NamingBean-xmbean.xml">
</mbean>

此示例取自 $SERVER/conf/jboss-service.xml,NamingBean-xmban.xml 位于属性描述的路径中.

This example is taken from $SERVER/conf/jboss-service.xml and the NamingBean-xmban.xml is in the path described by the attribute.

这篇关于如何为MBean方法添加描述以在JBOSS的jmx-console中查看的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆