On Wed, 18 Nov 2020 00:30:53 GMT, Paul Sandoz <psan...@openjdk.org> wrote:
>> Jim Laskey has updated the pull request with a new target base due to a >> merge or a rebase. The pull request now contains 40 commits: >> >> - Merge branch 'master' into 8248862 >> - 8248862: Implement Enhanced Pseudo-Random Number Generators >> >> Update package-info.java >> - 8248862: Implement Enhanced Pseudo-Random Number Generators >> >> Updated RandomGeneratorFactory javadoc. >> - 8248862: Implement Enhanced Pseudo-Random Number Generators >> >> Updated documentation for RandomGeneratorFactory. >> - Merge branch 'master' into 8248862 >> - Merge branch 'master' into 8248862 >> - 8248862: Implement Enhanced Pseudo-Random Number Generators >> >> Move RandomGeneratorProperty >> - Merge branch 'master' into 8248862 >> - 8248862: Implement Enhanced Pseudo-Random Number Generators >> >> Clear up javadoc >> - 8248862; Implement Enhanced Pseudo-Random Number Generators >> >> remove RandomGeneratorProperty from API >> - ... and 30 more: >> https://git.openjdk.java.net/jdk/compare/f7517386...6fe94c68 > > src/java.base/share/classes/java/util/random/RandomGeneratorFactory.java line > 148: > >> 146: */ >> 147: private static Map<String, Provider<? extends RandomGenerator>> >> getFactoryMap() { >> 148: if (factoryMap == null) { > > `factoryMap` needs to be marked volatile when using the double checked > locking idiom. fixing > src/java.base/share/classes/java/util/random/RandomGeneratorFactory.java line > 320: > >> 318: } >> 319: } >> 320: } > > Add an `assert` statement that `ctor`, `ctorLong` and `ctorBytes` are all > non-null? Only `ctor` is required but yes. > src/java.base/share/classes/java/util/random/RandomGeneratorFactory.java line > 331: > >> 329: */ >> 330: private void ensureConstructors() { >> 331: if (ctor == null) { > > This check occurs outside of the synchronized block, field may need to be > marked volatile. Unsure about the other dependent fields. Might need to store > values from loop in `getConstructors` in locals and then assign in > appropriate order, assigning the volatile field last. okay ------------- PR: https://git.openjdk.java.net/jdk/pull/1273