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

Stop using currentTimeMillis to calculate timeout in TestCSLocker

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 20
    • hotspot
    • gc

      currentTimeMillis() is not monotonically increasing. To me it seems sleep(timeout) would be much better (and easier to read).

      This is most probably not related to JDK-8293289, a huge offset in time would be needed like daytime saving.

      Although it is not causing JDK-8293289, it is still wrong.

      change
      ```
              // check timeout to success deadlocking
              while(System.currentTimeMillis() < startTime + timeout) {
                  System.out.println("sleeping...");
                  sleep(1000);
              }
      ```
      to something like: `sleep(timeout)`

            Unassigned Unassigned
            lkorinth Leo Korinth
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: