RFR (S): CR 8005926: (thread) Merge ThreadLocalRandom state into java.lang.Thread
Doug Lea
dl at cs.oswego.edu
Wed Jan 16 11:48:50 UTC 2013
On 01/16/13 03:59, Peter Levart wrote:
> - Instead of Thread.threadLocalRandomSeed field it has a
> Thread.threadLocalRandom reference field, pointing to an instance of TLR.
> - The ThreadLocalRandom is not a singleton, but an instance per thread (like
> JDK7's).
Yes, this is the "Plan B" I mentioned in mail last week.
I had explored this. Both on performance and resource grounds,
it is a little worse. Not hugely worse, but if we are going
to improve TLR, then might as well take the best option.
(Another reason to prefer current solution also serves as
a reply to Tom: Yes we don't like using Unsafe just to
bypass package-protection access control. But at least it
is just accessing simple scalars, not references.)
-Doug
More information about the core-libs-dev
mailing list