Skip to content

Commit e45d33f

Browse files
committed
DefaultMessageListenerContainer immediately invokes stop callback when not running
Issue: SPR-14233
1 parent 29da44c commit e45d33f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -614,6 +614,12 @@ public void start() throws JmsException {
614614
@Override
615615
public void stop(Runnable callback) throws JmsException {
616616
synchronized (this.lifecycleMonitor) {
617+
if (!isRunning() || this.stopCallback != null) {
618+
// Not started, already stopped, or previous stop attempt in progress
619+
// -> return immediately, no stop process to control anymore.
620+
callback.run();
621+
return;
622+
}
617623
this.stopCallback = callback;
618624
}
619625
stop();

0 commit comments

Comments
 (0)