DefaultMessageListenerContainer uses receiveTimeout for wait call on shutdown
Issue: SPR-11841
This commit is contained in:
parent
cddcf3637d
commit
d398bb7c51
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -169,6 +169,14 @@ public abstract class AbstractPollingMessageListenerContainer extends AbstractMe
|
|||
this.receiveTimeout = receiveTimeout;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the receive timeout (ms) configured for this listener container.
|
||||
* @since 4.2
|
||||
*/
|
||||
protected long getReceiveTimeout() {
|
||||
return this.receiveTimeout;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void initialize() {
|
||||
|
|
|
@ -563,7 +563,13 @@ public class DefaultMessageListenerContainer extends AbstractPollingMessageListe
|
|||
logger.debug("Still waiting for shutdown of " + this.activeInvokerCount +
|
||||
" message listener invokers");
|
||||
}
|
||||
this.lifecycleMonitor.wait();
|
||||
long timeout = getReceiveTimeout();
|
||||
if (timeout > 0) {
|
||||
this.lifecycleMonitor.wait(timeout);
|
||||
}
|
||||
else {
|
||||
this.lifecycleMonitor.wait();
|
||||
}
|
||||
}
|
||||
// Clear remaining scheduled invokers, possibly left over as paused tasks...
|
||||
for (AsyncMessageListenerInvoker scheduledInvoker : this.scheduledInvokers) {
|
||||
|
|
Loading…
Reference in New Issue