Thread::getId final method
Rafael Winterhalter
rafael.wth at gmail.com
Fri Mar 25 08:18:09 UTC 2022
Hello,
I was recently debugging an issue where threads' ids were used to identify
an origin thread. The issue turned out to be that the getId method was
overridden to return 0 for a row of threads in unrelated code, what broke
that processing.
I do now wonder if it would be a good idea to offer a new method on
java.lang.Thread that returns the thread id but that is final. Possibly,
getId should be deprecated in favour of that new method.
Or is there a valid reason to override getId that I am missing?
Thanks, Rafael
More information about the core-libs-dev
mailing list