将 VM 上的 JMX 属性设置为命令行参数

发布于 2024-08-26 05:00:47 字数 201 浏览 5 评论 0原文

我做了一些搜索,但似乎找不到办法做到这一点。

我们希望通过 JMX 主动监控我们的永久空间。看来最好的方法是通过“PS Perm Gen”内存池上的UsageThreshold 属性。默认情况下,该值设置为 0。有没有办法将其或任何 JMX 属性指定为 VM 的 -D 参数,以便可以在启动时自动设置?或者是否有另一种机制来自动加载 JMX 属性?

谢谢。

I've done some searching, but can't seem to find a way to do this.

We'd like to proactively monitor our permgen space via JMX. It seems the best way to do this is through the UsageThreshold attribute on the "PS Perm Gen" MemoryPool. By default, this is set to 0. Is there a way to specify this, or any JMX attribute, as a -D parameter to VM so this can be set automatically at startup? Or is there another mechanism to load JMX attributes automatically?

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

风尘浪孓 2024-09-02 05:00:47

看起来您可以以编程方式设置它 - 看看 MemoryPoolMXBean 和“使用阈值”部分。

如果您有一些代码以编程方式设置此值,那么让代码从属性文件或系统属性或其他任何内容读取要设置的值将是微不足道的。

Looks like you can set this programmatically - take a look at MemoryPoolMXBean and the section on "Usage Thresholds".

If you have some code to set this value programmatically then it would be trivial to have the code read the value to be set from a properties file or system property or whatever else.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文