avoid hanging in case of shutdown errors (SPR-7511)
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3622 50f2f4bb-b051-0410-bef5-90022cba6387
This commit is contained in:
parent
5cf889307a
commit
b8fbe4650e
|
|
@ -977,36 +977,38 @@ public class DefaultMessageListenerContainer extends AbstractPollingMessageListe
|
||||||
handleListenerSetupFailure(ex, true);
|
handleListenerSetupFailure(ex, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
synchronized (lifecycleMonitor) {
|
finally {
|
||||||
decreaseActiveInvokerCount();
|
synchronized (lifecycleMonitor) {
|
||||||
lifecycleMonitor.notifyAll();
|
decreaseActiveInvokerCount();
|
||||||
}
|
|
||||||
if (!messageReceived) {
|
|
||||||
this.idleTaskExecutionCount++;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
this.idleTaskExecutionCount = 0;
|
|
||||||
}
|
|
||||||
synchronized (lifecycleMonitor) {
|
|
||||||
if (!shouldRescheduleInvoker(this.idleTaskExecutionCount) || !rescheduleTaskIfNecessary(this)) {
|
|
||||||
// We're shutting down completely.
|
|
||||||
scheduledInvokers.remove(this);
|
|
||||||
if (logger.isDebugEnabled()) {
|
|
||||||
logger.debug("Lowered scheduled invoker count: " + scheduledInvokers.size());
|
|
||||||
}
|
|
||||||
lifecycleMonitor.notifyAll();
|
lifecycleMonitor.notifyAll();
|
||||||
clearResources();
|
|
||||||
}
|
}
|
||||||
else if (isRunning()) {
|
if (!messageReceived) {
|
||||||
int nonPausedConsumers = getScheduledConsumerCount() - getPausedTaskCount();
|
this.idleTaskExecutionCount++;
|
||||||
if (nonPausedConsumers < 1) {
|
}
|
||||||
logger.error("All scheduled consumers have been paused, probably due to tasks having been rejected. " +
|
else {
|
||||||
"Check your thread pool configuration! Manual recovery necessary through a start() call.");
|
this.idleTaskExecutionCount = 0;
|
||||||
|
}
|
||||||
|
synchronized (lifecycleMonitor) {
|
||||||
|
if (!shouldRescheduleInvoker(this.idleTaskExecutionCount) || !rescheduleTaskIfNecessary(this)) {
|
||||||
|
// We're shutting down completely.
|
||||||
|
scheduledInvokers.remove(this);
|
||||||
|
if (logger.isDebugEnabled()) {
|
||||||
|
logger.debug("Lowered scheduled invoker count: " + scheduledInvokers.size());
|
||||||
|
}
|
||||||
|
lifecycleMonitor.notifyAll();
|
||||||
|
clearResources();
|
||||||
}
|
}
|
||||||
else if (nonPausedConsumers < getConcurrentConsumers()) {
|
else if (isRunning()) {
|
||||||
logger.warn("Number of scheduled consumers has dropped below concurrentConsumers limit, probably " +
|
int nonPausedConsumers = getScheduledConsumerCount() - getPausedTaskCount();
|
||||||
"due to tasks having been rejected. Check your thread pool configuration! Automatic recovery " +
|
if (nonPausedConsumers < 1) {
|
||||||
"to be triggered by remaining consumers.");
|
logger.error("All scheduled consumers have been paused, probably due to tasks having been rejected. " +
|
||||||
|
"Check your thread pool configuration! Manual recovery necessary through a start() call.");
|
||||||
|
}
|
||||||
|
else if (nonPausedConsumers < getConcurrentConsumers()) {
|
||||||
|
logger.warn("Number of scheduled consumers has dropped below concurrentConsumers limit, probably " +
|
||||||
|
"due to tasks having been rejected. Check your thread pool configuration! Automatic recovery " +
|
||||||
|
"to be triggered by remaining consumers.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue