RFR: 8248862: Implement Enhanced Pseudo-Random Number Generators [v3]

Rémi Forax github.com+828220+forax at openjdk.java.net
Wed Nov 25 16:32:03 UTC 2020


On Wed, 25 Nov 2020 16:22:34 GMT, Jim Laskey <jlaskey at openjdk.org> wrote:

>> 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

If the second `RandomGeneratorFactory.factoryMap` return a non null value ...

-------------

PR: https://git.openjdk.java.net/jdk/pull/1292



More information about the security-dev mailing list