我試圖用jcmd VM.set_flag選項進行試驗。但遇到一個錯誤,說只有'可寫'標誌可以設置「。什麼是可寫標誌?jcmd VM.set_flag,哪些標誌是可寫的?
讓我的PID:
[email protected]:~/javacode$ jcmd -l
6294 Test
6295 jdk.jcmd/sun.tools.jcmd.JCmd -l
試圖改變VM標誌:
[email protected]:~/javacode$ jcmd 6294 VM.set_flag ConcGCThreads 4
6294:
only 'writeable' flags can be set
[email protected]:~/javacode$ jcmd 6294 VM.set_flag MaxNewSize 1G
6294:
only 'writeable' flags can be set
編輯:工作了管理的標誌,下面是成功的命令。
[email protected]:~/javacode$ jcmd 11441 VM.flags -all | grep MinHeapFreeRatio
uintx MinHeapFreeRatio = 40 {manageable} {default}
[email protected]:~/javacode$ jcmd 11441 VM.set_flag MinHeapFreeRatio 45
11441:
Command executed successfully
[email protected]:~/javacode$ jcmd 11441 VM.flags -all | grep MinHeapFreeRatio
uintx MinHeapFreeRatio = 45
VM.set_flag是在Java 9可用經由http://openjdk.java.net/jeps/228,它是jdk9特定選項。不是嗎? – Vipin