[jdk19] RFR: 8289183: jdk.jfr.consumer.RecordedThread.getId references Thread::getId, should be Thread::threadId
Alan Bateman
alanb at openjdk.org
Fri Jul 1 08:48:45 UTC 2022
On Thu, 30 Jun 2022 07:26:54 GMT, Erik Gahlin <egahlin at openjdk.org> wrote:
>> src/jdk.jfr/share/classes/jdk/jfr/consumer/RecordedThread.java line 100:
>>
>>> 98: * <p>
>>> 99: * See {@link #getJavaThreadId()} for the ID that is returned by
>>> 100: * {@code java.lang.Thread.threadId()}
>>
>> Looks okay but maybe it should be a link?
>
> I considered it, but the purpose of the comment is to help users not mix up getId() with getJavaThreadId() in the RecordedThread class. If users follows a link to java.lang.Thread and read about the two IDs there, it might confuse them. The difference between getId() and threadId() in j.l.Thread is not the same as in RecordedThread.
>
> That said, if you think a link would be helpful I can add it.
It might help to have "Java thread ID" in the RecordedThread::getThreadId descriptoin link to Thread::threadId. For RecordedThread::getId then maybe it just needs a `@see #getThreadId()` with no reference or link to j.l.Thread methods. But up to you, I don't have a strong opinion on this except that developers using this API understand that consuming a recording means dealing with non-Java threads and they have an ID too.
-------------
PR: https://git.openjdk.org/jdk19/pull/93
More information about the hotspot-jfr-dev
mailing list