Common Properties Of Locking Graphs


  Locking graphs show single locking situations in the JVM. In contrast to the monitor views, the locking graphs focus on the entire set of relationships of all involved monitors and threads rather than the duration of isolated monitor events.

There are two locking graphs:

  The following elements are shown in locking graphs:
  • Threads which participate in a locking situation are painted as blue rectangles. The rectangle includes information about
    • The thread name
    • The thread group (in brackets)
  • Monitors which participate in the locking situation are painted as gray rectangles. The rectangle includes information about
    • The class of the monitor
    • The monitor id which can be used to get further information about the monitor in the monitor views
  • The ownership of monitors which participate in a locking situation is painted as a solid black arrow. The arrowhead points from the thread to the monitor. To see details about where the monitor was entered, move the mouse over the arrow and see the information in the tool tip window.
  • The blocking of threads which participate in a locking situation is painted as a dashed red arrow. The arrowhead points from the blocked thread to the monitor that the thread wants to enter. To see details about where the thread is blocking, move the mouse over the arrow and see the information in the tool tip window.
  • The waiting of threads which participate in a locking situation is painted as a solid yellow arrow with a hollow arrowhead. The arrowhead points from the waiting thread to the monitor that the thread is waiting on. To see details about where the thread is waiting, move the mouse over the arrow and see the information in the tool tip window.
  • Threads or monitors that are part of a deadlock are painted in red.

The tool tip window shows a stack trace in a scrollable list whose context menu allows you to navigate to the source code or show the selected method in the byte code viewer. You can pin the tool tip window by toggling the  pin button in the top right corner of the tool tip window.

  Locks are analyzed for
  • the primitive synchronization mechanism that's built into the Java platform, i.e. when using the synchronized keyword.
  • the locking facility in the java.util.concurrent package which does not use monitors of objects but a different natively implemented mechanism.
  You can show any monitor in the heap walker by selecting the monitor node and choosing Show Selection In Heap Walker from the context menu. If a heap dump was already taken, you can choose to select the object in the current heap dump, otherwise a new heap dump will be taken.

Note that the selected monitor might not exist in the heap dump because the heap dump might have been taken before the monitor was allocated or after the monitor was garbage collected.