如何为JBean方法添加描述以在JBOSS的jmx-console中查看它 [英] How to add description for MBean method to see it in jmx-console of JBOSS
问题描述
我正在使用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. DynamicMBean
s 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描述符并把它放在例如到$ 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.
这篇关于如何为JBean方法添加描述以在JBOSS的jmx-console中查看它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!