开发者

Setting JMX attribute on VM as command line parameter

开发者 https://www.devze.com 2022-12-23 14:31 出处:网络
I\'ve done some searching, but can\'t seem to find a way开发者_StackOverflow社区 to do this. We\'d like to proactively monitor our permgen space via JMX.It seems the best way to do this is through th

I've done some searching, but can't seem to find a way开发者_StackOverflow社区 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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消