Fix #4244: Properly shutdown Axon janitor thread on Spring context close#4269
Open
wadhwaroh-lang wants to merge 3 commits intoAxonFramework:mainfrom
Open
Fix #4244: Properly shutdown Axon janitor thread on Spring context close#4269wadhwaroh-lang wants to merge 3 commits intoAxonFramework:mainfrom
wadhwaroh-lang wants to merge 3 commits intoAxonFramework:mainfrom
Conversation
Implements a Spring lifecycle handler to manage the shutdown of the Axon janitor executor service, ensuring proper termination during application shutdown.
Add tests for AxonTaskJanitorShutdownHandler functionality
Add bean creation method for AxonTaskJanitorShutdownHandler to ensure proper shutdown of the janitor executor service during Spring context closure.
Author
|
@AxonFramework/AxonFramework Please consider labeling this PR with below( as I don't have permissions yet) :
Thanks! |
Contributor
|
Thanks to bother to create a PR for this issue @wadhwaroh-lang, we'll be sure to have a look on this and align it with our efforts on 5.1.0 and 4.13.1. |
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
Fixes #4244: Ensure the Axon framework's janitor thread is properly shut down when the Spring context closes.
Problem
The janitor
ScheduledExecutorServiceintroduced in version 4.11 was not being shut down during Spring context shutdown. Since the janitor thread is a non-daemon thread, it prevented the JVM from exiting gracefully.Solution
Implemented
AxonTaskJanitorShutdownHandler- a SpringSmartLifecyclebean that:shutdown()on theAxonTaskJanitor.INSTANCEexecutor serviceshutdownNow()if termination times outChanges
AxonTaskJanitorShutdownHandlerimplementingSmartLifecycleAxonTimeoutAutoConfigurationTesting
Type of Change