On Mon, 13 May 2024 08:47:50 GMT, Raffaello Giulietti <[email protected]>
wrote:
> All random number generator algorithms are implemented in module `java.base`.
> The usage of `ServiceLoader` in `j.u.r.RandomGeneratorFactory` is no longer
> needed.
src/java.base/share/classes/java/util/random/RandomGeneratorFactory.java line
299:
> 297: private void ensureConstructors() {
> 298: if (ctor == null) { // volatile load
> 299: synchronized (rgClass) {
Here too I think we should synchronize on `this` - we would want to allow
multiple different instances of a `RandomGeneratorFactory` for the same
`RandomGenerator` class type to be able to concurrently instantiate their
individual instance fields (like the `ctor`(s) and `properties`).
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/19212#discussion_r1598500425