On Sun, 20 Dec 2020 19:48:43 GMT, Alan Bateman <al...@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? Fair enough; the solution proposed by Claes in #1855 seems to be a better alternative. Currently, I will keep this PR open but I expect this to be superseded by the latter. ------------- PR: https://git.openjdk.java.net/jdk/pull/1821