RFR: 8258588: MD5 MessageDigest in java.util.UUID should be cached

PROgrm_JARvis github.com+7693005+jarviscraft at openjdk.java.net
Sun Dec 20 22:43:54 UTC 2020


On Sun, 20 Dec 2020 19:48:43 GMT, Alan Bateman <alanb at 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



More information about the security-dev mailing list