RFR: 8303242: ThreadMXBean issues with virtual threads [v3]
Alan Bateman
alanb at openjdk.org
Thu Mar 2 08:18:05 UTC 2023
On Wed, 1 Mar 2023 21:46:54 GMT, Mandy Chung <mchung at openjdk.org> wrote:
>> Alan Bateman has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Update isXXXThreadCpuTimeSupported descriptions
>
> src/java.management/share/classes/java/lang/management/ThreadMXBean.java line 479:
>
>> 477: * if the thread of the specified ID exists, the thread is alive,
>> 478: * and CPU time measurement is enabled; {@code -1} if not enabled
>> 479: * or the specified ID is a virtual thread
>
> It should be "{@code -1} if not enabled or the specified ID is a virtual thread or the thread does not exist or not alive."
>
> Would this be simpler:
>
>
> * @return the total CPU time for a thread of the specified ID
> * if the thread of the specified ID is a platform thread, the thread is alive,
> * and CPU time measurement is enabled; {@code -1} otherwise.
>
>
> I'm fine with either way. Same comment for `getThreadUserTime(long)`
That is a bit better as it avoids needing to list conditions for the "otherwise" case. I've update these methods to use that style and also updated the CSR.
-------------
PR: https://git.openjdk.org/jdk/pull/12762
More information about the serviceability-dev
mailing list