RFR (S): CR 8005926: (thread) Merge ThreadLocalRandom state into java.lang.Thread

Peter Levart peter.levart at gmail.com
Wed Jan 16 13:48:45 UTC 2013

On 01/16/2013 12:48 PM, Doug Lea wrote:
> 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.)
Don't forget it is also writing them... :-(

Regards, Peter
> -Doug

More information about the core-libs-dev mailing list