tim at peierls.net
Mon Jan 12 13:29:54 EST 2009
Maybe say something about using it in ForkJoin stuff, now that you've pulled
it out of there?
On Mon, Jan 12, 2009 at 12:31 PM, Doug Lea <dl at cs.oswego.edu> wrote:
> As probably the final refactoring pass on Java7 versions of ForkJoin etc
> the thread-local random generator was pulled out into a stand-alone class.
> Class ThreadLocalRandom is useful in most situations where people use
> java.util.Random across multiple threads. It is a subclass of Random,
> but has no constructor -- instead a static "current()" method to
> get the one for the current thread. It also doesn't let you change
> the seed. (So people who need thread-local generators with explicit
> seed control can't use it.)
> The main reason for using it is performance, including performance
> testing. Using a contended shared Random will often be 10X slower,
> and mask the performance differences you are actually looking for.
> (Some SPEC benchmarks have had this problem.)
> Comments welcome.
> Also, as we move closer to jdk7 (openjdk) integration,
> anyone wanting to help with code or documentation reviews
> ot testing might want to take a look. See links from
> Concurrency-interest mailing list
> Concurrency-interest at cs.oswego.edu
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Concurrency-interest