Java線程的解釋線程狀態總是在以下十個狀態之一:Java線程:正在運行的JVM
NEW: Just starting up, i.e., in process of being initialized.
NEW_TRANS: Corresponding transition state (not used, included for completness).
IN_NATIVE: Running in native code.
IN_NATIVE_TRANS: Corresponding transition state.
IN_VM: Running in VM.
IN_VM_TRANS: Corresponding transition state.
IN_JAVA: Running in Java or in stub code.
IN_JAVA_TRANS: Corresponding transition state (not used, included for completness).
BLOCKED: Blocked in vm.
BLOCKED_TRANS: Corresponding transition state.
未使用狀態(UNINITIALIZED
)已經從列表中省略。
雖然給各州的定義上面我在尋找「原則進行的大拇指」解釋給定的線程狀態設置爲正在運行的應用程序服務器。並且,更具體地:
假設一個活動應用程序使用以下線程統計(使用jstack獲得)在不同的點服務器在時間:
- 100線程:35
BLOCKED
,65IN_NATIVE
- 113線程: 35
BLOCKED
,77IN_NATIVE
,1IN_VM
- 52線程:38
BLOCKED
,1IN_JAVA
,6IN_NATIVE
,7IN_VM
個
- 120線程:39
BLOCKED
,1IN_JAVA
,80個IN_NATIVE
- 94線程:34
BLOCKED
,59IN_NATIVE
,1IN_NATIVE_TRANS
對於五個統計量的每個線程 - 什麼可與關於該被推斷整體JVM狀態? I.e. 「在這種情況下的JVM看起來是怠速等待請求」,「機器是忙於處理要求」等
嗨,你在哪找到上述線程狀態描述? – StrikeW 2014-09-26 17:36:51
線程狀態及其描述可以在[HotSpot JVM的JavaThreadState類]中找到(http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b27/sun/jvm /hotspot/runtime/JavaThreadState.java)。 – kernelthree 2016-02-06 05:45:26