DefaultMessageListenerContainer clears resources of paused tasks when shutting down after stop

Issue: SPR-10092
This commit is contained in:
Juergen Hoeller
2012-12-13 11:29:51 +01:00
parent 8abe1f055e
commit cc11b811ea
2 changed files with 7 additions and 0 deletions

View File

@@ -214,6 +214,7 @@ public abstract class AbstractJmsListeningContainer extends JmsDestinationAccess
wasRunning = this.running;
this.running = false;
this.active = false;
this.pausedTasks.clear();
this.lifecycleMonitor.notifyAll();
}

View File

@@ -527,6 +527,7 @@ public class DefaultMessageListenerContainer extends AbstractPollingMessageListe
logger.debug("Waiting for shutdown of message listener invokers");
try {
synchronized (this.lifecycleMonitor) {
// Waiting for AsyncMessageListenerInvokers to deactivate themselves...
while (this.activeInvokerCount > 0) {
if (logger.isDebugEnabled()) {
logger.debug("Still waiting for shutdown of " + this.activeInvokerCount +
@@ -534,6 +535,11 @@ public class DefaultMessageListenerContainer extends AbstractPollingMessageListe
}
this.lifecycleMonitor.wait();
}
// Clear remaining scheduled invokers, possibly left over as paused tasks...
for (AsyncMessageListenerInvoker scheduledInvoker : this.scheduledInvokers) {
scheduledInvoker.clearResources();
}
this.scheduledInvokers.clear();
}
}
catch (InterruptedException ex) {