mirror of https://github.com/apache/activemq.git
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.
git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@394705 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
969eefeef0
commit
91720daee7
|
@ -45,8 +45,10 @@ import org.apache.activemq.util.JMSExceptionSupport;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
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.atomic.AtomicBoolean;
|
||||||
import edu.emory.mathcs.backport.java.util.concurrent.*;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A client uses a <CODE>MessageConsumer</CODE> object to receive messages
|
* A client uses a <CODE>MessageConsumer</CODE> object to receive messages
|
||||||
|
@ -560,6 +562,11 @@ public class ActiveMQMessageConsumer implements MessageAvailableConsumer, StatsC
|
||||||
deliverAcks();//only processes optimized acknowledgements
|
deliverAcks();//only processes optimized acknowledgements
|
||||||
if (executorService!=null){
|
if (executorService!=null){
|
||||||
executorService.shutdown();
|
executorService.shutdown();
|
||||||
|
try {
|
||||||
|
executorService.awaitTermination(60, TimeUnit.SECONDS);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
Thread.currentThread().interrupt();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ((session.isTransacted() || session.isDupsOkAcknowledge())) {
|
if ((session.isTransacted() || session.isDupsOkAcknowledge())) {
|
||||||
acknowledge();
|
acknowledge();
|
||||||
|
|
Loading…
Reference in New Issue