RFR JDK-8198253: ThreadInfo.from(CompositeData) assigning fields incorrectly in JDK 9
mandy chung
mandy.chung at oracle.com
Sat Feb 17 02:20:45 UTC 2018
Hi Jeremy,
lockedMonitors and lockedSynchronizers attribute are not optional if that's
the issue you try to resolve. I think the specification should be clarified.
ThreadInfo::from supports the three different versions for interoperability:
1. CompositeData for JDK 1.5 ThreadInfo with no lockedMonitors and
lockedSynchronizers attribute
2. CompositeData for JDK 6 ThreadInfo with lockedMonitors and lockedSynchronizers
attributes
3. CompositeData for JDK 9 ThreadInfo with lockedMonitors and lockedSynchronizers
attributes and with daemon and priority attribute.
JMX client can connect to a running VM in any version and get back a
proper ThreadInfo.
If ThreadInfo::from is called with a CompositeData containing daemon and
priority attribute but lockedMonitors and lockedSynchronizers attributes are
absent then the given CompositeData is invalid and IllegalArgumentException
should be thrown.
Does this help?
Mandy
On 2/15/18 4:46 PM, Jeremy Manson wrote:
> Hi folks,
>
> Been a long time! I'd like someone to do a code review. This is in
> code I wrote a few years ago, and got wrong. At the time, David
> Holmes, Staffan Larsen, and Mandy Chung reviewed it. It does mean
> that people using ThreadInfo.from(CompositeData) may be getting the
> wrong values out for ThreadInfo, so it is definitely worth fixing.
>
> The patch below fixes the bug, but is a pretty questionable approach.
> Better approaches happily considered.
>
> Patch:
> http://cr.openjdk.java.net/~jmanson/8198253/webrev.00/
> <http://cr.openjdk.java.net/%7Ejmanson/8198253/webrev.00/>
>
> Bug:
> https://bugs.openjdk.java.net/browse/JDK-8198253
>
> Thanks!
>
> Jeremy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/serviceability-dev/attachments/20180216/5c79c165/attachment.html>
More information about the serviceability-dev
mailing list