DefaultMessageListenerContainer immediately invokes stop callback when not running

Issue: SPR-14233
This commit is contained in:
Juergen Hoeller 2016-05-02 12:57:30 +02:00
parent 29da44c8dc
commit e45d33f9de
1 changed files with 6 additions and 0 deletions

View File

@ -614,6 +614,12 @@ public class DefaultMessageListenerContainer extends AbstractPollingMessageListe
@Override
public void stop(Runnable callback) throws JmsException {
synchronized (this.lifecycleMonitor) {
if (!isRunning() || this.stopCallback != null) {
// Not started, already stopped, or previous stop attempt in progress
// -> return immediately, no stop process to control anymore.
callback.run();
return;
}
this.stopCallback = callback;
}
stop();