Le diagramme représente java.lang.Thread.State
ENUM. The Javadoc is quite helpful to get an understanding of the mapping you seek.
L'état jVisualVM représentent le supplément de description de l'état que vous verriez dans une décharge de fil, par exemple:
"Finalizer" daemon prio=8 tid=0x022f4000 nid=0xd14 in Object.wait() [0x044cf000]
java.lang.Thread.State: WAITING (on object monitor)
vous pouvez donc déchiffrer l'état de votre propre, si vous obtenez un vidage de fil et de comparer l'état de JVisualVM et le vidage de threads par un nom de thread.
Voici le mapping vous voulez:
Running
->java.lang.Thread.State: RUNNABLE
Sleeping
->java.lang.Thread.State: TIMED_WAITING (sleeping)
Wait
->java.lang.Thread.State: WAITING TIMED_WAITING (on object monitor)
Park
->java.lang.Thread.State: WAITING TIMED_WAITING (parking)
Monitor
->java.lang.Thread.State: BLOCKED (on object monitor)
L'état Park
est un cas particulier de WAITING
ou TIMED_WAITING
. La différence par rapport à Wait
est que Wait
se produit sur un moniteur d'objet (c'est-à-dire Object.wait()
dans un bloc synchronized
). Le Park
, en revanche, supprime un thread de la planification via Unsafe.park
sans avoir besoin de tenir un moniteur (c'est-à-dire qu'il n'a pas besoin d'un bloc synchronized
).
Toujours pas clair pour moi. TIMED_WAITING vs WAITING TIMED_WAITING par exemple. Parking? – gstackoverflow
Vous pouvez vérifier cela dans le lien JavaDoc que j'ai ajouté. 'WAITING' - Etat de thread pour un thread en attente. Un thread est en attente en raison de l'appel de l'une des méthodes suivantes: Object.wait sans timeout, Thread.join sans timeout, LockSupport.park; 'TIMED_WAITING' - Etat de thread pour un thread en attente avec un temps d'attente spécifié. Un thread est dans l'état d'attente temporisé en raison de l'appel de l'une des méthodes suivantes avec un temps d'attente positif spécifié: Thread.sleep, Object.wait avec timeout, Thread.join avec timeout, LockSupport.parkNanos, LockSupport.parkUntil – bashnesnos
@gstackoverflow J'ai ajouté des précisions pour 'Park' ainsi – bashnesnos