mirror of https://github.com/apache/activemq.git
make sure we properly close down the advisory consumer; great catch by Manuel!
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@551857 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ec6e6a55a7
commit
56be6b93d3
|
@ -27,8 +27,11 @@ import org.apache.activemq.command.DataStructure;
|
||||||
import org.apache.activemq.command.DestinationInfo;
|
import org.apache.activemq.command.DestinationInfo;
|
||||||
import org.apache.activemq.command.MessageAck;
|
import org.apache.activemq.command.MessageAck;
|
||||||
import org.apache.activemq.command.MessageDispatch;
|
import org.apache.activemq.command.MessageDispatch;
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
public class AdvisoryConsumer implements ActiveMQDispatcher {
|
public class AdvisoryConsumer implements ActiveMQDispatcher {
|
||||||
|
private static final transient Log log = LogFactory.getLog(AdvisoryConsumer.class);
|
||||||
|
|
||||||
private final ActiveMQConnection connection;
|
private final ActiveMQConnection connection;
|
||||||
private ConsumerInfo info;
|
private ConsumerInfo info;
|
||||||
|
@ -46,8 +49,14 @@ public class AdvisoryConsumer implements ActiveMQDispatcher {
|
||||||
this.connection.syncSendPacket(this.info);
|
this.connection.syncSendPacket(this.info);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dispose() {
|
public synchronized void dispose() {
|
||||||
if (!closed) {
|
if (!closed) {
|
||||||
|
try {
|
||||||
|
this.connection.asyncSendPacket(info.createRemoveCommand());
|
||||||
|
}
|
||||||
|
catch (JMSException e) {
|
||||||
|
log.info("Failed to send remove command: " + e, e);
|
||||||
|
}
|
||||||
this.connection.removeDispatcher(info.getConsumerId());
|
this.connection.removeDispatcher(info.getConsumerId());
|
||||||
closed = true;
|
closed = true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue