Align task execution tracking and thread interruption on shutdown

Closes gh-35254
This commit is contained in:
Juergen Hoeller 2025-08-01 21:15:25 +02:00
parent 24e66b63d1
commit 67e88f3c20
2 changed files with 2 additions and 2 deletions

View File

@ -376,7 +376,7 @@ public class SimpleAsyncTaskScheduler extends SimpleAsyncTaskExecutor implements
@Override @Override
public boolean isRunning() { public boolean isRunning() {
return this.triggerLifecycle.isRunning(); return (this.triggerLifecycle.isRunning() || this.fixedDelayLifecycle.isRunning());
} }
@Override @Override

View File

@ -364,7 +364,6 @@ public class SimpleAsyncTaskExecutor extends CustomizableThreadCreator
this.active = false; this.active = false;
Set<Thread> threads = this.activeThreads; Set<Thread> threads = this.activeThreads;
if (threads != null) { if (threads != null) {
threads.forEach(Thread::interrupt);
synchronized (threads) { synchronized (threads) {
try { try {
if (!threads.isEmpty()) { if (!threads.isEmpty()) {
@ -375,6 +374,7 @@ public class SimpleAsyncTaskExecutor extends CustomizableThreadCreator
Thread.currentThread().interrupt(); Thread.currentThread().interrupt();
} }
} }
threads.forEach(Thread::interrupt);
} }
} }
} }