DefaultMessageListenerContainer uses receiveTimeout for wait call on shutdown
Issue: SPR-11841
This commit is contained in:
@@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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;
|
this.receiveTimeout = receiveTimeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the receive timeout (ms) configured for this listener container.
|
||||||
|
* @since 4.2
|
||||||
|
*/
|
||||||
|
protected long getReceiveTimeout() {
|
||||||
|
return this.receiveTimeout;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
|
|||||||
@@ -563,7 +563,13 @@ public class DefaultMessageListenerContainer extends AbstractPollingMessageListe
|
|||||||
logger.debug("Still waiting for shutdown of " + this.activeInvokerCount +
|
logger.debug("Still waiting for shutdown of " + this.activeInvokerCount +
|
||||||
" message listener invokers");
|
" 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...
|
// Clear remaining scheduled invokers, possibly left over as paused tasks...
|
||||||
for (AsyncMessageListenerInvoker scheduledInvoker : this.scheduledInvokers) {
|
for (AsyncMessageListenerInvoker scheduledInvoker : this.scheduledInvokers) {
|
||||||
|
|||||||
Reference in New Issue
Block a user