[英]How to add @ManagedAttribute and @ManagedOperation to an MBean that extends another class
I have created an MBean
that extends a class and implements interfaces. 我创建了一个
MBean
,它扩展了一个类并实现了接口。
I am trying to add some new @ManagedAttribute
and @ManagedOperation
but they are not shown in jconsole. 我正在尝试添加一些新的
@ManagedAttribute
和@ManagedOperation
但它们未在jconsole中显示。
I also see that the descriptions of the other attributes and operations are not shown correctly. 我还看到其他属性和操作的描述未正确显示。 The descriptions are set to default, although I set them in my class.
尽管我在课堂上设置了描述,但这些描述被设置为默认描述。
Is there any way to add new @ManagedAttribute
and @ManagedOperation
to my MBean
? 有什么方法可以向我的
MBean
添加新的@ManagedAttribute
和@ManagedOperation
吗?
And can I set the descriptions? 我可以设置说明吗?
I create two instances of the MBean
class with @MBean
annotation. 我用
@MBean
注释创建MBean
类的两个实例。
Is the problem that the MBean
created is of type StandardBean
and not DynamicBean
? 创建的
MBean
是否是StandardBean
类型而不是DynamicBean
类型的问题?
尝试在接口上声明管理属性和操作。
Make sure to mark the MBean with @ManagedResource to register it with the JMX Server. 确保使用@ManagedResource标记MBean,以将其注册到JMX服务器。 And also mark it as a @Component.
并将其标记为@Component。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.