[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-4460?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17626499#comment-17626499
 ] 

Alan Bateman commented on ZOOKEEPER-4460:
-----------------------------------------

The static analysis was >100k artifacts from Maven Central so I assume it 
analyzed many different versions. Sorry I didn't retain the results of the 
search but I think this was it:

[https://zookeeper.apache.org/doc/r3.8.0/apidocs/zookeeper-server/org/apache/zookeeper/server/quorum/QuorumPeer.html#getId--]

Code doing, for example, Thread.currentThread().getId() should expect to get 
the thread identifier so this is why overriding getId() is problematic. We 
deprecated the method in Java 19 and added a new final method threadId().

 

 

> QuorumPeer overrides Thread.getId with different semantics
> ----------------------------------------------------------
>
>                 Key: ZOOKEEPER-4460
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-4460
>             Project: ZooKeeper
>          Issue Type: Bug
>          Components: server
>            Reporter: Alan Bateman
>            Assignee: Chris Nauroth
>            Priority: Major
>
> In OpenJDK, Project Loom has significantly re-implemented java.lang.Thread. 
> One part of this is using some of the bits in the thread identifier for 
> non-exposed purposes. Sadly, Thread::getId is not final and it's possible 
> that sub-classes of Thread have overridden getId to have different semantics. 
> The JDK can defend against this but there may be 3rd party libraries that 
> make use of Thread::getId. A corpus search of Maven central found only one 
> class: org.apache.zookeeper.server.quorum.QuorumPeer. Does this project know 
> why getId has been overridden to return something that is not the thread 
> identifier?



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to