-
Enhancement
-
Resolution: Unresolved
-
P4
-
None
-
8u66
-
None
-
JDK 8u66, Win 8.1, 64 Bit
-
x86_64
-
windows_8
Steps to reproduce:
* Start the following program on Windows 8.1, then immediately suspend PC. Wait for ten minutes. Then wake up the PC.
```
private static final ScheduledExecutorService SCHEDULER = Executors.newSingleThreadScheduledExecutor();
static final void demonstrateSchedulerSleepover() {
final long requestedDelay = 60L;
final long startTime = System.nanoTime();
SCHEDULER.schedule(() -> System.out.printf("Requested Delay: %ds / Actual delay: %ds%n", requestedDelay, (System.nanoTime() - startTime) / 1000000000L),
requestedDelay, TimeUnit.SECONDS);
}
```
Expected result:
* Program prints "Requested Delay: 60s / Actual delay: 600s"
Actual result:
* Program prints "Requested Delay: 60s / Actual delay: 660s"
Conclusion:
* The length of the sleep period is added ontop of the requested delay. This is annoying and unexpected. There seems to be no way to tell executors that the delay has to be measured in times of "real time" not in time of "non-suspended VM ticks".
* Start the following program on Windows 8.1, then immediately suspend PC. Wait for ten minutes. Then wake up the PC.
```
private static final ScheduledExecutorService SCHEDULER = Executors.newSingleThreadScheduledExecutor();
static final void demonstrateSchedulerSleepover() {
final long requestedDelay = 60L;
final long startTime = System.nanoTime();
SCHEDULER.schedule(() -> System.out.printf("Requested Delay: %ds / Actual delay: %ds%n", requestedDelay, (System.nanoTime() - startTime) / 1000000000L),
requestedDelay, TimeUnit.SECONDS);
}
```
Expected result:
* Program prints "Requested Delay: 60s / Actual delay: 600s"
Actual result:
* Program prints "Requested Delay: 60s / Actual delay: 660s"
Conclusion:
* The length of the sleep period is added ontop of the requested delay. This is annoying and unexpected. There seems to be no way to tell executors that the delay has to be measured in times of "real time" not in time of "non-suspended VM ticks".
- relates to
-
JDK-8146730 LockSupport.parkUntil waits too long in case hibernation happened between invocation and deadline
-
- Open
-
-
JDK-8221971 Java Thread.sleep() on Windows 10 stops in S3 sleep status
-
- Closed
-