RFR: 6913: Add daemon thread information to the console threads view
Jan S.
github.com+924885+jpstotz at openjdk.java.net
Sat Oct 10 16:21:08 UTC 2020
On Tue, 29 Sep 2020 21:04:38 GMT, Alex Macdonald <aptmac at openjdk.org> wrote:
>> @aptmac I just noticed that you were not talking about the JVM running JMC but about the JVM JMC is connected to. That
>> makes a version check a bit more complicated, at least I don't see a way to do so with my limited knowledge on JMC.
>> My current approach uses a Getter in `org.openjdk.jmc.console.ui.tabs.threads.ThreadInfoCompositeSupport` that catches
>> potential `InvalidKeyException` that occur when enabling the Daemon column on a Java 8 VM. In such a case a defined
>> error string like "Data not available" is returned and shown for each thread as value in the Daemon column.
>> Do you think this is a suitable approach?
>
>> My current approach uses a Getter in `org.openjdk.jmc.console.ui.tabs.threads.ThreadInfoCompositeSupport` that catches
>> potential `InvalidKeyException` that occur when enabling the Daemon column on a Java 8 VM. In such a case a defined
>> error string like "Data not available" is returned and shown for each thread as value in the Daemon column.
>> Do you think this is a suitable approach?
>
> Yes, catching the exception in the `Getter.getMember()` could work. Alternatively, it might be cleaner to implement
> this like `IS_DEADLOCKED` or `GET_ALLOCATED_BYTES`, which also perform a check to see if the feature is enabled or not.
@aptmac Sorry for the delay, it took me some time to understand how the information extraction from other JVMs in
Missioncontrol works.
In the end I rejected some approaches I first had in mind and ended up with an simple approach that checks if the
daemon data has been extracted from the target JVM and if not returns the "data not available" message instead of the
actual daemon data.
Hopefully my current approach is what you had in mind when speaking about a clean solution. The two other approaches
you mentioned like `IS_DEADLOCKED` or `GET_ALLOCATED_BYTES` were not that helpful as they get the data from
`ThreadMXBean` not `ThreadInfo` and thus require a different way to handle it.
-------------
PR: https://git.openjdk.java.net/jmc/pull/110
More information about the jmc-dev
mailing list