开发者

ManagementFactory.getPlatformMBeanServer() vs MBeanServerFactory.createMBeanServer()

开发者 https://www.devze.com 2023-01-20 00:36 出处:网络
Can anyone please clarify what the differences are between the two? The Javadoc is really obscu开发者_StackOverflowre for my proper understanding.

Can anyone please clarify what the differences are between the two?

The Javadoc is really obscu开发者_StackOverflowre for my proper understanding.

One thing I have noticed is if I use ManagementFactory.getPlatformMBeanServer() to register my MBeans, I can view them in Jconsole. But, not so if I use MBeanServerFactory.createMBeanServer().

Why is that? Is that the only diffence?

Thanks.


ManagementFactory.getPlatformMBeanServer() returns a reference to the existing MBean server within the JVM. JConsole looks at the beans on that server.

If you use createMBeanServer(), that will create an entirely new server. JConsole has no knowledge of it, and so will not see the beans registered with it.

0

精彩评论

暂无评论...
验证码 换一张
取 消