On Sun, 23 Nov 2025 08:08:32 GMT, Alan Bateman <[email protected]> wrote:

> DelayScheduler.replace missing check to sift up when replaced with smaller 
> value. checkHeap checks invariants when replacing. Executing tests with make 
> run-test or other targets runs tests with -esa so assume is enabled.
> 
> New regression test to ensure delayed tests executes in expected delay order.

src/java.base/share/classes/java/util/concurrent/DelayScheduler.java line 401:

> 399:             }
> 400:         }
> 401:         assert checkHeap(h, n);

It's great to have this run during debug builds 👍

test/jdk/java/util/concurrent/DelayScheduler/AscendingOrderAfterReplace.java 
line 43:

> 41:     public static void main(String[] args) throws Exception {
> 42:         String delays = IntStream.of(DELAYS)
> 43:                 .mapToObj(i -> Integer.valueOf(i).toString())

Suggestion:

                .mapToObj(i -> Integer.toString(i))

test/jdk/java/util/concurrent/DelayScheduler/AscendingOrderAfterReplace.java 
line 45:

> 43:                 .mapToObj(i -> Integer.valueOf(i).toString())
> 44:                 .collect(Collectors.joining(", "));
> 45:         System.out.println("Delays: " + delays);

I presume this is to be removed.

test/jdk/java/util/concurrent/DelayScheduler/AscendingOrderAfterReplace.java 
line 60:

> 58:      */
> 59:     private static boolean testCancel(int indexToCancel) throws Exception 
> {
> 60:         System.out.println("=== Test cancel " + DELAYS[indexToCancel] + " 
> ===");

I presume this is to be removed.

test/jdk/java/util/concurrent/DelayScheduler/AscendingOrderAfterReplace.java 
line 82:

> 80: 
> 81:         // delayed tasks should have executed in ascending order of their 
> delay
> 82:         System.out.println(queue);

I presume this is to be removed.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/28469#discussion_r2553944932
PR Review Comment: https://git.openjdk.org/jdk/pull/28469#discussion_r2553941776
PR Review Comment: https://git.openjdk.org/jdk/pull/28469#discussion_r2553942028
PR Review Comment: https://git.openjdk.org/jdk/pull/28469#discussion_r2553942533
PR Review Comment: https://git.openjdk.org/jdk/pull/28469#discussion_r2553943281

Reply via email to