mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-17 16:39:29 +00:00
Clear remaining invoker resources when releasing shared Connection
Closes gh-35932
This commit is contained in:
+12
-4
@@ -757,10 +757,8 @@ public class DefaultMessageListenerContainer extends AbstractPollingMessageListe
|
||||
}
|
||||
waitCount++;
|
||||
}
|
||||
// Clear remaining scheduled invokers, possibly left over as paused tasks
|
||||
for (AsyncMessageListenerInvoker scheduledInvoker : this.scheduledInvokers) {
|
||||
scheduledInvoker.clearResources();
|
||||
}
|
||||
// Clear remaining scheduled invokers, possibly left over as paused tasks.
|
||||
clearResourcesInScheduledInvokers();
|
||||
this.scheduledInvokers.clear();
|
||||
}
|
||||
catch (InterruptedException ex) {
|
||||
@@ -910,6 +908,15 @@ public class DefaultMessageListenerContainer extends AbstractPollingMessageListe
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear resources in scheduled invokers, even in case of paused tasks.
|
||||
*/
|
||||
private void clearResourcesInScheduledInvokers() {
|
||||
for (AsyncMessageListenerInvoker scheduledInvoker : this.scheduledInvokers) {
|
||||
scheduledInvoker.clearResources();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Use a shared JMS Connection depending on the "cacheLevel" setting.
|
||||
* @see #setCacheLevel
|
||||
@@ -1427,6 +1434,7 @@ public class DefaultMessageListenerContainer extends AbstractPollingMessageListe
|
||||
if (activeInvokerCount == 0) {
|
||||
if (!isRunning()) {
|
||||
// Proactively release shared Connection when stopped.
|
||||
clearResourcesInScheduledInvokers();
|
||||
releaseSharedConnection();
|
||||
}
|
||||
if (stopCallback != null) {
|
||||
|
||||
Reference in New Issue
Block a user