在运行时更改JVM JIT选项 [英] Change JVM JIT Options at runtime

查看:103
本文介绍了在运行时更改JVM JIT选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在运行时更改Java JVM(JIT)的选项和/或模式?例如.更改XX:CompileThreshold,甚至在解释的代码和编译的代码之间进行切换(-Xcomp-Xint).

Is it possible to change options and/or modes of Java JVM (JIT) at runtime? E.g. change XX:CompileThreshold, or even switch between interpreted and compiled code (-Xcomp vs -Xint).

我的JVM来自OpenJDK(1.6),Hotspot或Zero/Shark

My JVM is from OpenJDK (1.6), Hotspot or Zero/Shark

推荐答案

您无法在运行时更改JVM模式,但是可以在不重新启动JVM的情况下修改某些标志.只需使用JMX客户端(如VisualVM)连接到JVM,然后使用com.sun.management:type=HotSpotDiagnosticsetVMOption操作即可.

You cannot change the JVM mode at runtime, however you can modify some flags without restarting the JVM. Just connect to the JVM using a JMX client (like VisualVM) and use the operation setVMOption of com.sun.management:type=HotSpotDiagnostic.

例如,如果要在不重新启动JVM的情况下启用详细的GC日志记录,请调用方法setVMOptions("PrintGCDetails", "true").

For instance, if you want to enable detailed GC logging without restarting the JVM, call the method setVMOptions("PrintGCDetails", "true").

来源:希望有帮助!

这篇关于在运行时更改JVM JIT选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆