RFR 7004967: SecureRandom should be more explicit about threading

Weijun Wang weijun.wang at oracle.com
Thu Aug 25 02:00:05 UTC 2016


Please review the enhancement at

   http://cr.openjdk.java.net/~weijun/7004967/webrev.00/

Basically, we want SecureRandom to be more efficient by removing all 
synchronized keywords from its public methods and let an implementation 
to take care of thread-safety (We already did some in JDK-8098581). On 
the other hand, we need to make sure that existing implementations that 
have not synchronized correctly to behave just as good as before.

Therefore a new Service Attribute "ThreadSafe" is introduced. If you 
think your implementation is already thread-safe, set it to "true" and 
SecureRandom will be happy. Otherwise, don't set it and SecureRandom 
will continuously call your SecureRandomSpi engine methods in 
synchronized blocks.

Thanks
Max



More information about the security-dev mailing list