Skip to content

Fixed the race condition: print dev mode ready message after WatchService registration - #526

Open
sajeerzeji wants to merge 1 commit into
OpenLiberty:mainfrom
sajeerzeji:GHLMP2070-Fix_race_condition_in_DevMojo_doDevMode
Open

Fixed the race condition: print dev mode ready message after WatchService registration#526
sajeerzeji wants to merge 1 commit into
OpenLiberty:mainfrom
sajeerzeji:GHLMP2070-Fix_race_condition_in_DevMojo_doDevMode

Conversation

@sajeerzeji

@sajeerzeji sajeerzeji commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Fixes OpenLiberty/ci.maven#2070

PR Ci.Maven: OpenLiberty/ci.maven#2073
PR Ci.Gradle: OpenLiberty/ci.gradle#1095

In DevUtil.watchFiles(), the "Liberty is running in dev mode." startup banner is now printed after all source, test, config, and resource directories have been registered with the WatchService, but before initWatchLoop() enters the event poll. Previously the banner was emitted by runHotkeyReaderThread() in the callers (ci.maven's DevMojo, ci.gradle's DevTask) before watchFiles() was even called, meaning any file change made immediately after that message by a test or a user could race ahead of the watcher and be silently dropped with no recompile triggered. Moving the print into watchFiles() and checking it in with the existing firstStartup flag makes the ready message a reliable synchronisation point: once a user or test sees it, the WatchService is fully set up and guaranteed to detect changes. The runHotkeyReaderThread() post test run re print path is unchanged.

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.

Fix race condition in DevMojo.doDevMode()

1 participant