RFR 8157318: ThreadedSeedGenerator uses System.currentTimeMillis and stops generating when time is set back
Bradford Wetmore
bradford.wetmore at oracle.com
Wed Jun 15 22:30:19 UTC 2016
Looks good, Max, thanks for taking this over.
Xuelei, it's a threaded accumulator, which feeds into the seed
generator. We wait a certain amount of time before generating the values.
Brad
On 6/15/2016 5:07 AM, Xuelei Fan wrote:
> I'm not sure I understand the while loop. But this update looks fine to
> me as it does not change the logic of the code except to use elapsed time.
>
> Xuelei
>
> On 6/15/2016 11:12 AM, Wang Weijun wrote:
>> Please take a review on the patch
>>
>> diff --git a/src/java.base/share/classes/sun/security/provider/SeedGenerator.java b/src/java.base/share/classes/sun/security/provider/SeedGenerator.java
>> --- a/src/java.base/share/classes/sun/security/provider/SeedGenerator.java
>> +++ b/src/java.base/share/classes/sun/security/provider/SeedGenerator.java
>> @@ -354,8 +354,8 @@
>> // We wait 250milli quanta, so the minimum wait time
>> // cannot be under 250milli.
>> int latch = 0;
>> - long l = System.currentTimeMillis() + 250;
>> - while (System.currentTimeMillis() < l) {
>> + long l = System.nanoTime() + 250000000;
>> + while (System.nanoTime() < l) {
>> synchronized(this){};
>> latch++;
>> }
>>
>> nanoTime() is for elapsed time and should be used here.
>>
>> Thanks
>> Max
>>
>
More information about the security-dev
mailing list