Skip to content

Commit 6fc5a78

Browse files
committed
Cancel without interruption of currently running tasks
Leave potential interruption up to scheduler shutdown. Closes gh-31019
1 parent d58e48d commit 6fc5a78

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

spring-context/src/main/java/org/springframework/scheduling/annotation/ScheduledAnnotationBeanPostProcessor.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,7 @@ public void postProcessBeforeDestruction(Object bean, String beanName) {
577577
}
578578
if (tasks != null) {
579579
for (ScheduledTask task : tasks) {
580-
task.cancel();
580+
task.cancel(false);
581581
}
582582
}
583583
}
@@ -595,7 +595,7 @@ public void destroy() {
595595
Collection<Set<ScheduledTask>> allTasks = this.scheduledTasks.values();
596596
for (Set<ScheduledTask> tasks : allTasks) {
597597
for (ScheduledTask task : tasks) {
598-
task.cancel();
598+
task.cancel(false);
599599
}
600600
}
601601
this.scheduledTasks.clear();

spring-context/src/main/java/org/springframework/scheduling/config/ScheduledTaskRegistrar.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ public Set<ScheduledTask> getScheduledTasks() {
553553
@Override
554554
public void destroy() {
555555
for (ScheduledTask task : this.scheduledTasks) {
556-
task.cancel();
556+
task.cancel(false);
557557
}
558558
if (this.localExecutor != null) {
559559
this.localExecutor.shutdownNow();

0 commit comments

Comments
 (0)