Skip to content

Run callback for shutdown also when container is already shut down #1562

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 7, 2023

Conversation

timbq
Copy link
Contributor

@timbq timbq commented Feb 3, 2023

see #1561

Copy link
Member

@artembilan artembilan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, consider also to add your name to the @author list of those changed classes.

@@ -641,6 +641,9 @@ private void shutdownAndWaitOrCallback(@Nullable Runnable callback) {
}
else {
logger.info("Shutdown ignored - container is already stopped");
if (callback != null) {
getTaskExecutor().execute(callback);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no reason to call this callback on a different thread.

Plus, take a look, please, there is one more return in this method where we have to take care about this callback, too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right! I will fix this and cover the other case as soon as I get around to work on this again.

@artembilan artembilan merged commit 931896d into spring-projects:main Feb 7, 2023
@artembilan
Copy link
Member

... and cherry-picked to 2.4.x

@timbq,

thank you for contribution; looking forward for more!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants