是否可以通过远程 JVM 获取 MemoryMXBean 实例?
我发现这篇不错的文章解释了如何查询虚拟机的当前内存 http://recursor.blogspot.com/2006/10/memory-notifications-in-java.html
我的问题是,是否可以轻松地从远程虚拟机获取 MemoryMXBean 类的实例(我该如何做到这一点),或者我是否必须手动查询 MBean?
I found this nice article which explains how to query your current memory for your VM http://recursor.blogspot.com/2006/10/memory-notifications-in-java.html
My question is, is it possible to get an instance of the MemoryMXBean class from a remote VM easily (and how would I do that), or do I have to resort to query the MBeans manually?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如此页面< /a> 您可以使用
MBeanServerConnection
远程访问它:但是,据我了解,您将无法使用 Java 接口,您需要查询所需的属性与
and
这是非常可怕的(“字符串类型”界面,正如他们在另一个问题中所说)。
正如 Brian Agnew 所说,JConsole 视图对于查找所需信息的存储位置非常有用。
as described on this page you can access it remotly, with the
MBeanServerConnection
:however, as far as I understand, you won't be able to use the Java interface, you'll need to query the properties you want with
and
which is quite awfull ('stringly-typed' interface, as they said in another question).
As Brian Agnew said, the JConsole view is very usefull to find out where the information you want is stored.
您可以远程查询 JMX bean。 请参阅 JMX 连接器 JMX 教程中的部分。
最简单的方法可能是使用 JConsole 来确定您想要的内容查询(在本例中为 MemoryMXBean),然后围绕该查询编写代码。
You can query JMX beans remotely. See the JMX Connectors section in the JMX tutorial.
The straightforward approach may be to use JConsole to determine what you want to query (in this case your MemoryMXBean) and then code around that.