Skip to content

Commit 67e88f3

Browse files
committed
Align task execution tracking and thread interruption on shutdown
Closes gh-35254
1 parent 24e66b6 commit 67e88f3

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

spring-context/src/main/java/org/springframework/scheduling/concurrent/SimpleAsyncTaskScheduler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ public void stop(Runnable callback) {
376376

377377
@Override
378378
public boolean isRunning() {
379-
return this.triggerLifecycle.isRunning();
379+
return (this.triggerLifecycle.isRunning() || this.fixedDelayLifecycle.isRunning());
380380
}
381381

382382
@Override

spring-core/src/main/java/org/springframework/core/task/SimpleAsyncTaskExecutor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,6 @@ public void close() {
364364
this.active = false;
365365
Set<Thread> threads = this.activeThreads;
366366
if (threads != null) {
367-
threads.forEach(Thread::interrupt);
368367
synchronized (threads) {
369368
try {
370369
if (!threads.isEmpty()) {
@@ -375,6 +374,7 @@ public void close() {
375374
Thread.currentThread().interrupt();
376375
}
377376
}
377+
threads.forEach(Thread::interrupt);
378378
}
379379
}
380380
}

0 commit comments

Comments
 (0)