如何让 JMX 变得简单
我需要向 JMX 公开 30 个不同类中的大约 60 个操作。使用DynamicMBean
来实现它有点烦人。我正在寻找一种快速而优雅的方法来做到这一点。
我知道 Spring 有一个很好的注释方式,但我没有在这个项目中使用 spring。
I need to expose about 60 operations in a 30 different classes to JMX. Making it with DynamicMBean
is a bit annoying. I am looking for a fast and elegant way to do it.
I know that Spring has a nice way with annotations but i am not using spring in this project.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
请看一下我的 SimpleJmx Java 包,它旨在使用注释通过 JMX 轻松发布 Bean。它也有客户端代码。
快速代码示例:
以下是定义 bean 的方法。
欢迎反馈。
Please take a look at my SimpleJmx Java package which is designed to easily publish beans via JMX using annotations. It also has client code as well.
Quick code sample:
Here's how to define a bean.
Feedback welcome.
如果只是一组简单的操作,您可以使用 Clojure contrib 中提供的 JMX 支持:
Clojure Contrib
Clojure 编译为 Java,因此与当前项目集成不会有太多问题。
If it's just a set of easy operations, you could use the JMX support provided in Clojure contrib:
Clojure Contrib
Clojure compiles to Java so you would not have much problems integrating with your current project.
您是否看过 @MXBean 注释,它可能就是您所追求的,并且是 Java 6 的一部分。
Have you seen the @MXBean annotation, it may be what you're after, and is part of Java 6.