r246@34: chirino | 2007-02-23 14:49:53 -0500

Avoid hanging connection if dispatch fails when shutdowninfo is sent
 
 


git-svn-id: https://svn.apache.org/repos/asf/activemq/branches/activemq-4.1@511090 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Hiram R. Chirino 2007-02-23 20:25:42 +00:00
parent f56d9221ad
commit 05d37654df
2 changed files with 8 additions and 6 deletions

View File

@ -583,8 +583,6 @@ public class ActiveMQMessageConsumer implements MessageAvailableConsumer, StatsC
public void dispose() throws JMSException {
if (!unconsumedMessages.isClosed()) {
//log.warn("Consumer is being disposed.", new Exception("trace exception."));
// Do we have any acks we need to send out before closing?
// Ack any delivered messages now. (session may still
// commit/rollback the acks).

View File

@ -826,7 +826,10 @@ public class TransportConnection implements Service, Connection, Task, CommandVi
if( disposed.get() ) {
if( dispatchStopped.compareAndSet(false, true)) {
if( transportException.get()==null ) {
dispatch(new ShutdownInfo());
try {
dispatch(new ShutdownInfo());
} catch (Throwable ignore) {
}
}
dispatchStoppedLatch.countDown();
}
@ -930,11 +933,12 @@ public class TransportConnection implements Service, Connection, Task, CommandVi
}
taskRunner.wakeup();
dispatchStoppedLatch.await();
if( taskRunner!=null )
if( taskRunner!=null ) {
taskRunner.wakeup();
dispatchStoppedLatch.await();
taskRunner.shutdown();
}
// Run the MessageDispatch callbacks so that message references get cleaned up.
for (Iterator iter = dispatchQueue.iterator(); iter.hasNext();) {