Browse Source

Use try-with-resources when applicable

See gh-32610
pull/32622/head
ali dandach 2 years ago committed by Stéphane Nicoll
parent
commit
82b51479d5
  1. 5
      spring-jms/src/main/java/org/springframework/jms/connection/SingleConnectionFactory.java

5
spring-jms/src/main/java/org/springframework/jms/connection/SingleConnectionFactory.java

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

Loading…
Cancel
Save