activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r551857 - /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/AdvisoryConsumer.java
Date Fri, 29 Jun 2007 11:34:22 GMT
Author: jstrachan
Date: Fri Jun 29 04:34:20 2007
New Revision: 551857

URL: http://svn.apache.org/viewvc?view=rev&rev=551857
Log:
make sure we properly close down the advisory consumer; great catch by Manuel!

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/AdvisoryConsumer.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/AdvisoryConsumer.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/AdvisoryConsumer.java?view=diff&rev=551857&r1=551856&r2=551857
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/AdvisoryConsumer.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/AdvisoryConsumer.java Fri
Jun 29 04:34:20 2007
@@ -27,8 +27,11 @@
 import org.apache.activemq.command.DestinationInfo;
 import org.apache.activemq.command.MessageAck;
 import org.apache.activemq.command.MessageDispatch;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 public class AdvisoryConsumer implements ActiveMQDispatcher {
+    private static final transient Log log = LogFactory.getLog(AdvisoryConsumer.class);
 
     private final ActiveMQConnection connection;
     private ConsumerInfo info;
@@ -46,8 +49,14 @@
         this.connection.syncSendPacket(this.info);
     }
 
-    public void dispose() {
+    public synchronized void dispose() {
         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());
             closed = true;
         }



Mime
View raw message