Skip to content

Stabilize JDK 21 flaky assertion in DelegatingScheduledExecutorServiceTest#287

Draft
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-failing-github-actions-job
Draft

Stabilize JDK 21 flaky assertion in DelegatingScheduledExecutorServiceTest#287
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-failing-github-actions-job

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jun 7, 2026

build (21) was failing due to a nondeterministic assertion in DelegatingScheduledExecutorServiceTest: shutdownNow() occasionally returned an empty list under JDK 21 scheduling timing. This change makes the test deterministic by guaranteeing a pending task exists at shutdown.

  • Root cause addressed

    • assertFalse(instance.shutdownNow().isEmpty()) depended on transient queue state and could fail when no pending tasks remained.
  • Test hardening change

    • Added a long-delay scheduled task immediately before shutdownNow() so the executor always has at least one queued, non-started task.
    • Added TimeUnit.DAYS static import for the long-delay scheduling call.
  • Relevant code change

    instance.schedule(() -> {
        log("delayed schedule");
    }, 1, DAYS);
    
    assertFalse(instance.shutdownNow().isEmpty());

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Jun 7, 2026

Copilot AI changed the title [WIP] Fix failing GitHub Actions job "build (21)" Stabilize JDK 21 flaky assertion in DelegatingScheduledExecutorServiceTest Jun 7, 2026
Copilot AI requested a review from mercyblitz June 7, 2026 13:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants