RFR: 8334405: java/nio/channels/Selector/SelectWithConsumer.java#id0 failed in testWakeupDuringSelect [v2]

Alan Bateman alanb at openjdk.org
Wed Jul 31 18:08:42 UTC 2024


On Wed, 31 Jul 2024 17:55:06 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

>> Replace differences of milliseconds vs. epoch to differences of nanoseconds per the JVM's high-resolution time source.
>
> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8334405: Add and use expectDuration() in ms

Marked as reviewed by alanb (Reviewer).

test/jdk/java/nio/channels/Selector/SelectWithConsumer.java line 313:

> 311:             long start = millisTime();
> 312:             int n = sel.select(k -> assertTrue(false), 1000L);
> 313:             expectDuration(start, 501, Long.MAX_VALUE);

501 looks a bit strange here, I realise it's the same as > 500 that was there, just may be less surprising to see 500.

test/jdk/java/nio/channels/Selector/SelectWithConsumer.java line 336:

> 334:             long start = millisTime();
> 335:             int n = sel.select(k -> assertTrue(false), 60*1000);
> 336:             expectDuration(start, 0, 4999);

Maybe use 20_000 instead 4999 here, only to deal with really slow machines.

test/jdk/java/nio/channels/Selector/SelectWithConsumer.java line 357:

> 355:             long start = millisTime();
> 356:             int n = sel.select(k -> assertTrue(false), 60*1000);
> 357:             expectDuration(start, 501, 10*1000 - 1);

I think I would make this one 0, 20_000, again for slow machines and also because the test is about select rather than the accuracy of scheduleWakeup.

test/jdk/java/nio/channels/Selector/SelectWithConsumer.java line 382:

> 380:             long start = millisTime();
> 381:             int n = sel.select(k -> assertTrue(false), 60*1000);
> 382:             expectDuration(start, 0, 4999);

I would use 20_000 here too.

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

PR Review: https://git.openjdk.org/jdk/pull/20398#pullrequestreview-2210810266
PR Review Comment: https://git.openjdk.org/jdk/pull/20398#discussion_r1698902303
PR Review Comment: https://git.openjdk.org/jdk/pull/20398#discussion_r1698902907
PR Review Comment: https://git.openjdk.org/jdk/pull/20398#discussion_r1698906013
PR Review Comment: https://git.openjdk.org/jdk/pull/20398#discussion_r1698906896


More information about the nio-dev mailing list