File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed
spring-jms/src/main/java/org/springframework/jms/listener Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -757,10 +757,8 @@ protected void doShutdown() throws JMSException {
757757 }
758758 waitCount ++;
759759 }
760- // Clear remaining scheduled invokers, possibly left over as paused tasks
761- for (AsyncMessageListenerInvoker scheduledInvoker : this .scheduledInvokers ) {
762- scheduledInvoker .clearResources ();
763- }
760+ // Clear remaining scheduled invokers, possibly left over as paused tasks.
761+ clearResourcesInScheduledInvokers ();
764762 this .scheduledInvokers .clear ();
765763 }
766764 catch (InterruptedException ex ) {
@@ -910,6 +908,15 @@ private void scheduleNewInvoker() {
910908 }
911909 }
912910
911+ /**
912+ * Clear resources in scheduled invokers, even in case of paused tasks.
913+ */
914+ private void clearResourcesInScheduledInvokers () {
915+ for (AsyncMessageListenerInvoker scheduledInvoker : this .scheduledInvokers ) {
916+ scheduledInvoker .clearResources ();
917+ }
918+ }
919+
913920 /**
914921 * Use a shared JMS Connection depending on the "cacheLevel" setting.
915922 * @see #setCacheLevel
@@ -1431,6 +1438,7 @@ private void decreaseActiveInvokerCount() {
14311438 if (activeInvokerCount == 0 ) {
14321439 if (!isRunning ()) {
14331440 // Proactively release shared Connection when stopped.
1441+ clearResourcesInScheduledInvokers ();
14341442 releaseSharedConnection ();
14351443 }
14361444 if (stopCallback != null ) {
You can’t perform that action at this time.
0 commit comments