changeset 39127:2c67712d6935

8157318: ThreadedSeedGenerator uses System.currentTimeMillis and stops generating when time is set back Reviewed-by: xuelei, wetmore
author weijun
date Tue, 21 Jun 2016 11:09:13 +0800
parents 1d9492ef71e9
children e991a1c8b41b
files jdk/src/java.base/share/classes/sun/security/provider/SeedGenerator.java
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/jdk/src/java.base/share/classes/sun/security/provider/SeedGenerator.java	Mon Jun 20 19:31:03 2016 -0700
+++ b/jdk/src/java.base/share/classes/sun/security/provider/SeedGenerator.java	Tue Jun 21 11:09:13 2016 +0800
@@ -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 startTime = System.nanoTime();
+                        while (System.nanoTime() - startTime < 250000000) {
                             synchronized(this){};
                             latch++;
                         }