BITMAG-1276-refactor JMS resource - #93
Open
Knud-Aage wants to merge 2 commits into
Open
Conversation
Added 2 test methods
…r-to-try-with-resources # Conflicts: # bitrepository-core/src/test/java/org/bitrepository/protocol/bus/RawMessagebus.java
ole-v-v
approved these changes
Jul 27, 2026
ole-v-v
left a comment
Contributor
There was a problem hiding this comment.
Overall looks fine. Please see my detail comments.
| } | ||
| } No newline at end of file | ||
|
|
||
| @Test |
| dedicatedMessageBus.close(); | ||
|
|
||
| addStep("Attempt to send a message on the closed message bus", | ||
| "The send should fail, since the underlying JMS session and connection have been closed."); |
Contributor
There was a problem hiding this comment.
Nitpicking, English usually hasn’t got any comma before “since”. Here and in line 217.
| } | ||
|
|
||
| /** | ||
| * Closes the producer session, consumer session and connection. Declared in reverse close order so |
Contributor
There was a problem hiding this comment.
Nitpicking: The declaration order is an implementation detail and does not belong in the Javadoc. Put it in a comment inside the method instead. The guarantee that all are attempted regardless of exceptions does belong here.
| * Closes the connection, suppressing any JMSException, so it can be safely used for cleanup after a | ||
| * failed initialisation without masking the original error. | ||
| */ | ||
| private void closeQuietly(Connection connection) { |
Contributor
There was a problem hiding this comment.
You have this method in two places, here and in RawMessagebus. Can we have it only once and reuse it?
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.
JVM now guarantees they're closed fully and safely — even if closing one resource throws, the others are still attempted, and the original exception isn't masked.