RFR: 6913: Add daemon thread information to the console threads view

Jan S. github.com+924885+jpstotz at openjdk.java.net
Mon Sep 28 12:02:08 UTC 2020


On Wed, 23 Sep 2020 21:15:43 GMT, Alex Macdonald <aptmac at openjdk.org> wrote:

>> I had an Java application which did not exit because of a non-daemon thread still running. Therefore I added a column
>> to the treads view that displays if a thread is a daemon thread or not.
>> oca: has been signed on 2019-01-17 (got positive response from Dalibor Topic on 2019-01-23).
>
> Hi @jpstotz !
> 
> The new daemon column looks okay and works well. Having said that, this won't work on jvms running on jdk8 [0]; the
> daemon information is added to `java.lang.management.ThreadInfo` as of jdk9 [1], and trying to use this column on a
> jdk8 jvm results in an error dialog (which when paired with the polling nature of the console pages makes this rather
> difficult to close jmc).  Let me know if you need a JIRA issue created for this PR and I can set one up.
> [0] https://docs.oracle.com/javase/8/docs/api/java/lang/management/ThreadInfo.html
> [1] https://docs.oracle.com/javase/9/docs/api/index.html?java/lang/management/ThreadInfo.html

@aptmac Thanks for reviewing my patch.
I had not noticed that there is a Java version restriction on the used ThreadInfo class. As (daemon) threads are
nothing new in Java this is really a surprise to me that this information is not available on Java 8. But now it makes
perfectly sense why jmc did not already provide such a column.

As mitigation I would assume that the best way would be to check the Java version number before adding the `isDaemon`
in `org.openjdk.jmc.console.ui.tabs.threads.ThreadTableSectionPart`. Hopefully the other definitions in
ThreadInfoCompositeSupport don't cause any problems if not used.

I will check this out and update my patch.

Regarding the JIRA issue this would be nice of you.

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

PR: https://git.openjdk.java.net/jmc/pull/110


More information about the jmc-dev mailing list