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.
我想通过一个java程序访问MemoryPool Mbeans,这样我就可以检索一段时间内的Eden Space、Perm Gen space、CodeCahe、Survior Space统计信息。这个怎么做?我试过 java.lang:type=MemoryPool,name=Eden Space
我不走运
谢谢,尚卡尔
以下对我来说很好:'java.lang:type=MemoryPool,name=PS Eden Space'
如果您通过 JConsole 连接到您的应用程序,您将能够看到可用的 MBean 以及您想要使用的 MBean 的确切 ObjectName。
有办法做到这一点。使用 ManagementFactory.MEMORY_POOL_MXBEAN_DOMAIN_TYPE,* 定义对象名称,获取实例。这解决了我的问题。