Skip to content

Commit cc11b81

Browse files
committed
DefaultMessageListenerContainer clears resources of paused tasks when shutting down after stop
Issue: SPR-10092
1 parent 8abe1f0 commit cc11b81

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

org.springframework.jms/src/main/java/org/springframework/jms/listener/AbstractJmsListeningContainer.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ public void shutdown() throws JmsException {
214214
wasRunning = this.running;
215215
this.running = false;
216216
this.active = false;
217+
this.pausedTasks.clear();
217218
this.lifecycleMonitor.notifyAll();
218219
}
219220

org.springframework.jms/src/main/java/org/springframework/jms/listener/DefaultMessageListenerContainer.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,13 +527,19 @@ protected void doShutdown() throws JMSException {
527527
logger.debug("Waiting for shutdown of message listener invokers");
528528
try {
529529
synchronized (this.lifecycleMonitor) {
530+
// Waiting for AsyncMessageListenerInvokers to deactivate themselves...
530531
while (this.activeInvokerCount > 0) {
531532
if (logger.isDebugEnabled()) {
532533
logger.debug("Still waiting for shutdown of " + this.activeInvokerCount +
533534
" message listener invokers");
534535
}
535536
this.lifecycleMonitor.wait();
536537
}
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();
537543
}
538544
}
539545
catch (InterruptedException ex) {

0 commit comments

Comments
 (0)