Use try-with-resources when applicable

See gh-32610
This commit is contained in:
ali dandach 2024-04-10 01:29:21 +03:00 committed by Stéphane Nicoll
parent 2d408685ce
commit 82b51479d5
1 changed files with 1 additions and 4 deletions

View File

@ -575,14 +575,11 @@ public class SingleConnectionFactory implements ConnectionFactory, QueueConnecti
logger.debug("Closing shared JMS Connection: " + con);
}
try {
try {
try (con) {
if (this.startedCount > 0) {
con.stop();
}
}
finally {
con.close();
}
}
catch (jakarta.jms.IllegalStateException ex) {
logger.debug("Ignoring Connection state exception - assuming already closed: " + ex);