Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何创建由 jmx 公开并通过 jconsole 访问的性能计数器?
假设每当我实例化一个特定对象时,我都会增加一个计数器。我想公开计数器值,以便可以在 jconsole 中查看该值。
我该怎么做呢?
有几个步骤:
ManagementFactory.getPlatformMBeanServer().registerMBean(...)
JMX 教程中有详细信息。