Monitors Tab

When the current debug session is paused, the Monitors tab will display threads that are currently contending for an object monitor and threads that are currently holding one or more object monitors. The Monitors tab is very useful when you are debugging multi-threaded programs whose threads need to cooperate with one another in order to perform a common function or goal.

The Monitors Tab is organized by threads. Only those threads that own monitors or are currently waiting for an object monitor or both are displayed in this tab. If there are currently no threads that own monitors nor any threads that are waiting for monitors, a message node will be displayed in the monitors tree indicating this.

Monitor information is displayed in a tree format. The first visible level will be the names of all the threads that are currently waiting for an object monitor and/or are holding monitors. Threads that are waiting for an object will display the object identifier they are waiting for. Threads that are not waiting for an object but are rather holding onto monitors will display their thread status just before the debug session was paused.

Expanding the node for a thread waiting for an object monitor will reveal the fully-qualified class name of the object the thread is waiting for. Any monitors this thread already holds will be displayed as well.

Expanding the node for a thread that is not waiting for an object monitor but is holding onto monitors will reveal the fully-qualified class names of all monitors this thread is currently holding.

Expanding the node for any object monitor will reveal the names of the thread that current holds this monitor followed by the names of all threads (if any) that are waiting to obtain this object monitor.

Thus, using the Monitors tab you can easily spot certain deadlock conditions that occur and determine quickly which threads are causing the deadlock because information about which monitors a thread holds and which monitor a thread is waiting for is clearly presented.

Not all debug VMs support viewer object monitor information. For instance, the HotSpot JVM engine running in debug mode does not support querying of monitor information.

Set as Current Thread

To make any visible thread in the Monitors tab the current thread, right-click on the thread name and select Set as Current Thread from the popup menu.

Inspect Object in New Window

To examine the fields of any object monitor being held by or waited on by one or more threads, right-click on the monitor in question and select the Inspect Object in New Window from the popup menu.