On Fri, 18 Dec 2020 20:11:26 GMT, Stuart Marks <sma...@openjdk.org> wrote:

> I have to say that introducing a ThreadLocal here seems like a step in the 
> wrong direction. With a ThreadLocal, if I read this correctly, a 
> MessageDigest will be cached with each thread that ever calls this API, and 
> it won't be garbage collected until the thread dies. Some threads live 
> indefinitely, e.g., the ones in the fork-join common pool. Is this what we 
> want? Is UUID creation so frequent that each thread needs its own, or could 
> thread safety be handled using a simple locking protocol?

This is a good point. Significant effort has gone into recent releases to 
reduce the use of TLs in the (JDK-8245309, JDK-8245308, JDK-8245304, 
JDK-8245302) so adding new usages is a disappointing. So I think this PR does 
need good justifications, and probably a lot more exploration of options.

-------------

PR: https://git.openjdk.java.net/jdk/pull/1821

Reply via email to