RFC Bug: 8154176: Threads Native ID should be available from Thread and/or ThreadMXBean.getThreadInfo()

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

RFC Bug: 8154176: Threads Native ID should be available from Thread and/or ThreadMXBean.getThreadInfo()

JSR166 Concurrency mailing list
I would be interested in getting some opinions on this enhancement request.

https://bugs.openjdk.java.net/browse/JDK-8154176

Thanks,
David

_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://cs.oswego.edu/mailman/listinfo/concurrency-interest
Reply | Threaded
Open this post in threaded view
|

Re: RFC Bug: 8154176: Threads Native ID should be available from Thread and/or ThreadMXBean.getThreadInfo()

JSR166 Concurrency mailing list
On Wed, Mar 21, 2018 at 8:17 AM, David Holmes via Concurrency-interest
<[hidden email]> wrote:
> I would be interested in getting some opinions on this enhancement request.
>
> https://bugs.openjdk.java.net/browse/JDK-8154176

In your comment you state:

> From a core API design perspective the problem is that there is no cross-platform notion of "native thread id" and that it infers a 1:1 mapping between Java threads and native threads which need not exist. That is why I feel it unsuitable as a method on Thread.

I don't think that it is necessary for there to be a 1:1 mapping
between Java and native threads for native ID to be present or useful
on Thread.  If a thread has no native ID, a native ID getter could
return a value representing "unknown".  OTOH having the native ID
available to processes could be quite valuable; for example I could
add it to my log when it is present, which may allow me to quickly
correlate CPU-burning threads with their log activity, instead of the
current approach of: convert thread PID to base16, grep for it in
jstack output, then grep for thread name in log (hoping there aren't
two threads with the same name for whatever reason).

In short, if the value is present, it has potential value to the user;
if it is absent, then we're no worse off than before.

--
- DML
_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://cs.oswego.edu/mailman/listinfo/concurrency-interest
Reply | Threaded
Open this post in threaded view
|

Re: RFC Bug: 8154176: Threads Native ID should be available from Thread and/or ThreadMXBean.getThreadInfo()

JSR166 Concurrency mailing list
In reply to this post by JSR166 Concurrency mailing list
> I also agree it is a reasonable compromise to only export it via ThreadInfo / ThreadMXBean. 

This also means that people (Java >=9) that wants to use it, needs a dependency on "java.management". 
Process.pid() just needs "java.base".

/Kasper


On 21 March 2018 at 14:17, David Holmes via Concurrency-interest <[hidden email]> wrote:
I would be interested in getting some opinions on this enhancement request.

https://bugs.openjdk.java.net/browse/JDK-8154176

Thanks,
David

_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://cs.oswego.edu/mailman/listinfo/concurrency-interest


_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://cs.oswego.edu/mailman/listinfo/concurrency-interest
Reply | Threaded
Open this post in threaded view
|

Re: RFC Bug: 8154176: Threads Native ID should be available from Thread and/or ThreadMXBean.getThreadInfo()

JSR166 Concurrency mailing list
I am new to writing code in Java, so not sure why someone didn't bring this up yet.

Beyond what is mentioned in the discussion around the enhancement request, it certainly improves debuggability of a java application which needs to interact with native components like custom APIs or applications that are interacting with device drivers.  

-Johri  


_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://cs.oswego.edu/mailman/listinfo/concurrency-interest