title: How do I figure out what's holding a lock and blocking my Java thread?
body: <p>I'm using Wildfly 11 with Java 8 on Amazon Linux.  We're troubleshooting a high CPU utilization issue and have the Wildfly CLI tool at our disposal.  I noticed some of our Java threads have been running for quite awhile and wanted to figure out why.  I found the ID of one thread and checked its status ...</p>
  
  <pre><code>[standalone@localhost:9990 /] /core-service=platform-mbean/type=threading/:get-thread-infos (ids=[2L])
  {
      "outcome" =&gt; "success",
      "result" =&gt; [{
          "thread-id" =&gt; 2L,
          "thread-name" =&gt; "Reference Handler",
          "thread-state" =&gt; "WAITING",
          "blocked-time" =&gt; -1L,
          "blocked-count" =&gt; 48628L,
          "waited-time" =&gt; -1L,
          "waited-count" =&gt; 44877L,
          "lock-info" =&gt; {
              "class-name" =&gt; "java.lang.ref.Reference$Lock",
              "identity-hash-code" =&gt; 926576350
          },
          "lock-name" =&gt; "java.lang.ref.Reference$Lock@373a6ede",
          "lock-owner-id" =&gt; -1L,
          "lock-owner-name" =&gt; undefined,
          "stack-trace" =&gt; [],
          "suspended" =&gt; false,
          "in-native" =&gt; false,
          "locked-monitors" =&gt; [],
          "locked-synchronizers" =&gt; []
      }]
  }
  </code></pre>
  
  <p>I don't have a firm understanding of everything here but it does seem like one issue is a lock -- "class-name" => "java.lang.ref.Reference$Lock" .  Does anyone know how I can get more information about what's causing the lock?  </p>