Protect JMS connection creation against prepareConnection errors#29116
Merged
simonbasle merged 2 commits intospring-projects:mainfrom Feb 28, 2023
lenoch7:SingleConnectionFactory-Reconnection
Merged
Protect JMS connection creation against prepareConnection errors#29116simonbasle merged 2 commits intospring-projects:mainfrom lenoch7:SingleConnectionFactory-Reconnection
simonbasle merged 2 commits intospring-projects:mainfrom
lenoch7:SingleConnectionFactory-Reconnection
Conversation
|
@lenoch7 Please sign the Contributor License Agreement! Click here to manually synchronize the status of this Pull Request. See the FAQ for frequently asked questions. |
|
@lenoch7 Thank you for signing the Contributor License Agreement! |
Contributor
Author
|
I made next commit (I am very sorry, squash can be done later of course). This change should prevent to leave reference to SingleConnectionFactory (via exception listener) in invalid connection in case when connection.start() method throws JMSException. |
The creation of new JMS connection (after reset) is done in local method field (instead of instance field directly) to prevent situation, when connection is not correctly configured/prepared in case when JMSException from prepare() method is thrown. See gh-29115
Contributor
Author
|
I squash my two commits and rebase it on current HEAD. Is something still missing in this PR? What I can do? |
simonbasle
reviewed
Feb 6, 2023
simonbasle
approved these changes
Feb 28, 2023
This was referenced Feb 28, 2023
simonbasle
pushed a commit
that referenced
this pull request
Feb 28, 2023
This commit uses a local variable for the creation of a new JMS Connection so that a rare failure in prepareConnection(...) does not leave the connection field in a partially initialized state. If such a JMSException occurs, the intermediary connection is closed. This commit further defends against close() failures at that point, by logging the close exception at DEBUG level. As a result, the original JMSException is always re-thrown. See gh-29116 Closes gh-30051
Contributor
Author
|
Thank you for merge. |
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.
The creation of new JMS connection (after reset) is done in local method field (instead of instance field directly) to prevent situation, when connection is not correctly configured/prepared in case when JMSException from prepare() method is thrown.
See gh-29115