我尝试使用 JVM MBean 获取监控应用程序的以下详细信息
thread-states.blocked
thread-states.waiting
gc.ConcurrentMarkSweep.runs
gc.ParNew.runs
thread_count
daemon_thread_count
memory.heap_usage
memory.non_heap_usage
我能够获取其中的大部分内容,除了
thread-states.blocked
thread-states.waiting
gc.ConcurrentMarkSweep.runs
gc.ParNew.runs
有人知道可以使用什么 MBean 和属性来收集这些值吗? PS:在将其发布到此处之前,我已经用谷歌搜索过此内容
最佳答案
thread-states.blocked
thread-states.waiting
您可以使用getAllThreadIds()
并获取每个Thread的信息getThreadInfo()
并根据状态进行过滤
gc.ConcurrentMarkSweep.runs
gc.ParNew.runs
获取getGarbageCollectorMXBeans()
过滤它们以获取 CMS 和 ParNew 以及 getCollectionCount()
关于java - 从 JVM MBean 获取信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24666612/