RFR: 8365057: Add support for java.util.concurrent lock information to Thread.dump_to_file

Alan Bateman alanb at openjdk.org
Wed Sep 24 06:33:15 UTC 2025


On Tue, 23 Sep 2025 20:22:31 GMT, Alex Menkov <amenkov at openjdk.org> wrote:

> The fix updates `jcmd Thread.dump_to_file`/`HotSpotDiagnosticMXBean.dumpThreads` implementation to report thread which owns parkBlocker.
> 
> Testing: tier1..4,hs-tier5-svc

src/java.base/share/classes/jdk/internal/vm/ThreadDumper.java line 208:

> 206:                 Object parkBlocker = snapshot.parkBlocker();
> 207:                 if (parkBlocker != null) {
> 208:                     String suffix = (snapshot.parkBlockerOwner() != null)

This was `if (snapshot.parkBlockerOwner() instanceof Thread owner)` in the original prototype. It avoids the null check and allow L209 to use owner.threadId(). It also is consistent with the other use of pattern matching with instanceof in this code.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/27457#discussion_r2374569271


More information about the serviceability-dev mailing list