RFR: 8357285 : JSR166 Test case testShutdownNow_delayedTasks failed

Doug Lea dl at openjdk.org
Thu May 22 18:48:50 UTC 2025


On Thu, 22 May 2025 14:59:04 GMT, Viktor Klang <vklang at openjdk.org> wrote:

>> test/jdk/java/util/concurrent/tck/ScheduledExecutorTest.java line 703:
>> 
>>> 701:         final ScheduledThreadPoolExecutor p = new ScheduledThreadPoolExecutor(1);
>>> 702:         List<ScheduledFuture<?>> tasks = new ArrayList<>();
>>> 703:         final int DELAY = 100;
>> 
>> What do you think of trying to change this to `Utils.adjustTimeout(100)` so the env could change this depending on the factor used? This way may be the delay won't need to be as large.
>
> @myankelev The tasks are not expected to run, so the delay does not impact the duration of the test execution. The problem is rather that if they *do run* that the test fails, so if we move the delay further into the future, the test is less prone to failing spuriously.

I agree. This change is the only one that comes to mind to make spurious failure much less likely.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25394#discussion_r2103199492


More information about the core-libs-dev mailing list