Change JVM JIT Options at runtime

﹥>﹥吖頭↗ 提交于 2019-12-07 07:47:57

问题


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).

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


回答1:


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.

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

Source : http://docs.oracle.com/javase/6/docs/jre/api/management/extension/com/sun/management/HotSpotDiagnosticMXBean.html#setVMOption%28java.lang.String,%20java.lang.String%29

Hope that helps !




回答2:


You can change some of those settings through MBeans.

Most of them are read-only though.



来源:https://stackoverflow.com/questions/16860029/change-jvm-jit-options-at-runtime

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!