RFR: 8332086: Remove the usage of ServiceLoader in j.u.r.RandomGeneratorFactory
Jaikiran Pai
jpai at openjdk.org
Mon May 13 13:44:14 UTC 2024
On Mon, 13 May 2024 08:47:50 GMT, Raffaello Giulietti <rgiulietti at openjdk.org> 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
More information about the core-libs-dev
mailing list