Java JVM profiling, thread status - what does "Monitor" status mean?

user84592 picture user84592 · Jul 15, 2011 · Viewed 29.5k times · Source

enter image description here

I use visualVM connect a multi thread Java application, thread has 4 status, namely running, sleeping, wait, Monitor. What does this Monitoring status mean? What's the difference between wait and Monitor?

Answer

Jesper picture Jesper · Jul 15, 2011

These states are the same as mentioned in the Thread.State enum. "Wait" means, as the documentation says:

A thread is in the waiting state due to calling one of the following methods:

  • Object.wait with no timeout
  • Thread.join with no timeout
  • LockSupport.park

"Monitor" is the BLOCKED state, in which the thread is waiting to obtain a lock on an object (because it's trying to enter a synchronized block or method while another thread already holds the associated lock).