Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8146527

Scheduled execution ignores PC suspend mode

    Details

    • Type: Enhancement
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 8u66
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:
      None
    • Environment:

      JDK 8u66, Win 8.1, 64 Bit

      Description

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

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                mkarg Markus Karg
                Reporter:
                mkarg Markus Karg
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated: