Pil0tXia opened a new pull request, #4113: URL: https://github.com/apache/eventmesh/pull/4113
Fixes #4110. ### Motivation If a thread is interrupted while in a blocked state, in order to prevent subsequent code from making erroneous judgments after handling the interruption, the `InterruptedException` is thrown and at the same time, the `Thread.interrupted()` method is called to clear the thread's interrupt status. If the dispatcher is interrupted while executing the `take()` method, it will catch the `InterruptedException` exception and continue executing the exception handling block. At this point, the information about the thread being interrupted should not be lost. However, because `InterruptedException` is a `checked exception`, if it is not handled, it will be propagated to the method caller and may be thrown in `EventMeshHTTPServer.java`, resulting in a delayed closure of the thread. Moreover, there is no timely exit or restoration of the interrupt status at this point, so the thread may continue executing the `retry()` method, thereby losing the information about the thread being interrupted. However, the issue states that `InterruptedExceptions` should be re-thrown, but I think this handling is inappropriate. This approach does not reset the thread's interrupt status nor does it communicate the intention and semantics of the thread being interrupted to other developers. It would be better to reset the interrupt status. ### Modifications Catch the InterruptedException exception and re-interrupt the thread. ### Documentation - Does this pull request introduce a new feature? (no) - If yes, how is the feature documented? (not documented) - If a feature is not applicable for documentation, explain why? - If a feature is not documented yet in this PR, please create a followup issue for adding the documentation -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
