activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r394705 - /incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQMessageConsumer.java
Date Mon, 17 Apr 2006 15:29:45 GMT
Author: chirino
Date: Mon Apr 17 08:29:43 2006
New Revision: 394705

URL: http://svn.apache.org/viewcvs?rev=394705&view=rev
Log:
On consumer close, wait for it's async threads to finish before returning.  Was getting errors
when async acks were sent and the subscription was allready closed.

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

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQMessageConsumer.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQMessageConsumer.java?rev=394705&r1=394704&r2=394705&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQMessageConsumer.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQMessageConsumer.java
Mon Apr 17 08:29:43 2006
@@ -45,8 +45,10 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
+import edu.emory.mathcs.backport.java.util.concurrent.ExecutorService;
+import edu.emory.mathcs.backport.java.util.concurrent.Executors;
+import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit;
 import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicBoolean;
-import edu.emory.mathcs.backport.java.util.concurrent.*;
 
 /**
  * A client uses a <CODE>MessageConsumer</CODE> object to receive messages
@@ -560,6 +562,11 @@
             deliverAcks();//only processes optimized acknowledgements
             if (executorService!=null){
                 executorService.shutdown();
+                try {
+                    executorService.awaitTermination(60, TimeUnit.SECONDS);
+                } catch (InterruptedException e) {
+                    Thread.currentThread().interrupt();
+                }
             }
             if ((session.isTransacted() || session.isDupsOkAcknowledge())) {
                 acknowledge();



Mime
View raw message