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

Dr Heinz M. Kabutz heinz at javaspecialists.eu
Mon Jan 14 22:36:34 UTC 2013


The padded fields are interesting, as in Java 7 they would quite possibly be optimized away or at least rearranged, no? My own tests certainly suggested this. Probably a case for @Contended? Also, do you intend on moving the padding fields over to Thread too?

Other than my questions about padding, for what it's worth, I think this is a splendid suggestion :-)

On 15/01/2013, Alan Bateman <Alan.Bateman at oracle.com> wrote:

On 14/01/2013 18:20, Chris Hegarty wrote:

Ooooooh.... this change goes beyond my review capability!!! I thought we were just eliminating the indirection of ThreadLocal, anyway...

As a basic review I don't see anything obviously wrong, and I don't have a problem with adding the fields to j.l.Thread, but I'm not in a position to review in detail the algorithm used. Alan, did mention that he may be in a better position to do a detailed review. I can also sponsor this change. I looked at the changes and they look good to me. The additional fields of java.lang.Thread shouldn't be an issue. The other thing I notice is that the serialized form of the original ThreadLocalRandom included the padding fields, I guess they should have been transient in the original implementation. -Alan.

-- Dr Heinz M. Kabutz (PhD CompSci) Author of "The Java(tm) Specialists' Newsletter" Sun Java Champion IEEE Certified Software Development Professional http://www.javaspecialists.eu Tel: +30 69 75 595 262 Skype: kabutz



More information about the core-libs-dev mailing list