On Wed, 25 Nov 2020 13:38:59 GMT, Rémi Forax <github.com+828220+fo...@openjdk.org> wrote:
>> Jim Laskey has updated the pull request incrementally with one additional >> commit since the last revision: >> >> 8248862: Implement Enhanced Pseudo-Random Number Generators >> >> Changes to RandomGeneratorFactory requested by @PaulSandoz > > src/java.base/share/classes/java/util/random/RandomGeneratorFactory.java line > 106: > >> 104: * Map of provider classes. >> 105: */ >> 106: private static volatile Map<String, Provider<? extends >> RandomGenerator>> factoryMap; > > should be FACTORY_MAP given that it's a static field will fall out of using class holder idiom > src/java.base/share/classes/java/util/random/RandomGeneratorFactory.java line > 151: > >> 149: if (fm == null) { >> 150: synchronized (RandomGeneratorFactory.class) { >> 151: if (RandomGeneratorFactory.factoryMap == null) { > > if `RandomGeneratorFactory.factoryMap` is not null, it returns null because > the value is not stored in fm. > > Please use the class holder idiom (cf Effective Java) instead of using the > double-check locking pattern. ? set in 148 and 152, but class holder idiom +1 ------------- PR: https://git.openjdk.java.net/jdk/pull/1292