Repository navigation
chore: #2058 Re-interrupt thread when catching InterruptedException - #2062
Merged
lbroudoux merged 1 commit intoApr 30, 2026
Conversation
…eption Sonar flagged three catch blocks that swallow InterruptedException without preserving the thread's interrupted status, so callers waiting on cancellation never see the signal. Restore the canonical pattern of calling Thread.currentThread().interrupt() in the catch body. - AsyncAPITestManager.AsyncAPITestThread#run (L129): re-interrupt after logging that the test thread was interrupted. - NATSMessageConsumptionTask#close (L137): re-interrupt after logging the close-time exception so callers can still observe cancellation. - MockControllerCommons#waitForDelay (L350): narrow the overly broad catch (Exception) to catch (InterruptedException) - Object#wait only declares InterruptedException, and the surrounding synchronized block guarantees we hold the monitor - then re-interrupt. No behavioural change for the normal exception-free path; threads that get interrupted while waiting will now correctly propagate the interrupt signal up the stack. Signed-off-by: Git-HimanshuRathi <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
minions/async—AsyncAPITestManager.AsyncAPITestThread#run(L129): re-interrupt after logging that the test thread was interrupted.minions/async—NATSMessageConsumptionTask#close(L137): re-interrupt after logging the close-time exception so callers can still observe cancellation.webapp—MockControllerCommons#waitForDelay(L350): narrow the overly broadcatch (Exception)tocatch (InterruptedException)—Object#wait()only declaresInterruptedException, and the surroundingsynchronized (semaphore)block guarantees we hold the monitor, so the catch was wider than necessary — then re-interrupt.mvn spotless:check -pl minions/async,webapppasses locally.Related issue(s)
See also #2058