@@ -337,9 +337,10 @@ public final int getConcurrentConsumers() {
337337	 * to scale the consumption of messages coming in from a queue. However, 
338338	 * note that any ordering guarantees are lost once multiple consumers are 
339339	 * registered. In general, stick with 1 consumer for low-volume queues. 
340- 	 * <p><b>Do not raise the number of concurrent consumers for a topic.</b> 
341- 	 * This would lead to concurrent consumption of the same message, 
342- 	 * which is hardly ever desirable. 
340+ 	 * <p><b>Do not raise the number of concurrent consumers for a topic, 
341+ 	 * unless vendor-specific setup measures clearly allow for it.</b> 
342+ 	 * With regular setup, this would lead to concurrent consumption 
343+ 	 * of the same message, which is hardly ever desirable. 
343344	 * <p><b>This setting can be modified at runtime, for example through JMX.</b> 
344345	 * @see #setConcurrentConsumers 
345346	 */ 
@@ -526,13 +527,19 @@ protected void doShutdown() throws JMSException {
526527		logger .debug ("Waiting for shutdown of message listener invokers" );
527528		try  {
528529			synchronized  (this .lifecycleMonitor ) {
530+ 				// Waiting for AsyncMessageListenerInvokers to deactivate themselves... 
529531				while  (this .activeInvokerCount  > 0 ) {
530532					if  (logger .isDebugEnabled ()) {
531533						logger .debug ("Still waiting for shutdown of "  + this .activeInvokerCount  +
532534								" message listener invokers" );
533535					}
534536					this .lifecycleMonitor .wait ();
535537				}
538+ 				// Clear remaining scheduled invokers, possibly left over as paused tasks... 
539+ 				for  (AsyncMessageListenerInvoker  scheduledInvoker  : this .scheduledInvokers ) {
540+ 					scheduledInvoker .clearResources ();
541+ 				}
542+ 				this .scheduledInvokers .clear ();
536543			}
537544		}
538545		catch  (InterruptedException  ex ) {
0 commit comments