mirror of https://github.com/apache/activemq.git
Avoid the ugly 'Async exception with no exception listener' message from showing up in the output when shutting down the broker.
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@648250 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2d5c942bb2
commit
ce7495ec1e
|
@ -1692,7 +1692,7 @@ public class ActiveMQConnection implements Connection, TopicConnection, QueueCon
|
|||
});
|
||||
|
||||
} else {
|
||||
LOG.warn("Async exception with no exception listener: " + error, error);
|
||||
LOG.debug("Async exception with no exception listener: " + error, error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ package org.apache.activemq.broker.util;
|
|||
import javax.jms.Connection;
|
||||
import javax.jms.ConnectionFactory;
|
||||
import javax.jms.Destination;
|
||||
import javax.jms.ExceptionListener;
|
||||
import javax.jms.JMSException;
|
||||
import javax.jms.MessageConsumer;
|
||||
import javax.jms.Session;
|
||||
|
@ -39,7 +40,7 @@ import org.springframework.beans.factory.InitializingBean;
|
|||
* @version $Revision$
|
||||
* @org.apache.xbean.XBean
|
||||
*/
|
||||
public class CommandAgent implements Service, InitializingBean, DisposableBean, FactoryBean {
|
||||
public class CommandAgent implements Service, InitializingBean, DisposableBean, FactoryBean, ExceptionListener {
|
||||
private static final Log LOG = LogFactory.getLog(CommandAgent.class);
|
||||
|
||||
private String brokerUrl = "vm://localhost";
|
||||
|
@ -137,6 +138,7 @@ public class CommandAgent implements Service, InitializingBean, DisposableBean,
|
|||
public Connection getConnection() throws JMSException {
|
||||
if (connection == null) {
|
||||
connection = createConnection();
|
||||
connection.setExceptionListener(this);
|
||||
connection.start();
|
||||
}
|
||||
return connection;
|
||||
|
@ -164,4 +166,11 @@ public class CommandAgent implements Service, InitializingBean, DisposableBean,
|
|||
protected Destination createCommandDestination() {
|
||||
return AdvisorySupport.getAgentDestination();
|
||||
}
|
||||
|
||||
public void onException(JMSException exception) {
|
||||
try {
|
||||
stop();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue