Skip to content

Commit 5a55b83

Browse files
committed
refined logging in JMS SingleConnectionFactory and DefaultMessageListenerContainer
1 parent 5c2d637 commit 5a55b83

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

org.springframework.jms/src/main/java/org/springframework/jms/connection/SingleConnectionFactory.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ public Connection createConnection(String username, String password) throws JMSE
234234
}
235235

236236
public QueueConnection createQueueConnection() throws JMSException {
237-
Connection con = null;
237+
Connection con;
238238
synchronized (this.connectionMonitor) {
239239
this.pubSubMode = Boolean.FALSE;
240240
con = createConnection();
@@ -252,7 +252,7 @@ public QueueConnection createQueueConnection(String username, String password) t
252252
}
253253

254254
public TopicConnection createTopicConnection() throws JMSException {
255-
Connection con = null;
255+
Connection con;
256256
synchronized (this.connectionMonitor) {
257257
this.pubSubMode = Boolean.TRUE;
258258
con = createConnection();
@@ -298,6 +298,7 @@ public void initConnection() throws JMSException {
298298
* Exception listener callback that renews the underlying single Connection.
299299
*/
300300
public void onException(JMSException ex) {
301+
logger.warn("Encountered a JMSException - resetting the underlying JMS Connection", ex);
301302
resetConnection();
302303
}
303304

org.springframework.jms/src/main/java/org/springframework/jms/listener/DefaultMessageListenerContainer.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -738,10 +738,10 @@ protected void handleListenerSetupFailure(Throwable ex, boolean alreadyRecovered
738738
msg.append(getDestinationDescription()).append("' - trying to recover. Cause: ");
739739
msg.append(ex instanceof JMSException ? JmsUtils.buildExceptionMessage((JMSException) ex) : ex.getMessage());
740740
if (logger.isDebugEnabled()) {
741-
logger.info(msg, ex);
741+
logger.warn(msg, ex);
742742
}
743743
else {
744-
logger.info(msg);
744+
logger.warn(msg);
745745
}
746746
}
747747
}
@@ -792,10 +792,10 @@ protected void refreshConnectionUntilSuccessful() {
792792
msg.append(this.recoveryInterval).append(" ms. Cause: ");
793793
msg.append(ex instanceof JMSException ? JmsUtils.buildExceptionMessage((JMSException) ex) : ex.getMessage());
794794
if (logger.isDebugEnabled()) {
795-
logger.info(msg, ex);
795+
logger.warn(msg, ex);
796796
}
797-
else if (logger.isInfoEnabled()) {
798-
logger.info(msg);
797+
else {
798+
logger.warn(msg);
799799
}
800800
}
801801
sleepInbetweenRecoveryAttempts();

0 commit comments

Comments
 (0)