Skip to content

Commit 9ee3a73

Browse files
committed
https://github.com/spring-projects/spring-framework/issues/26482
1. build.gradle: comment io.spring.gradle-enterprise-conventions plugin 2. gradle.properties: set version=5.2.8.RELEASE-SHUTDOWN 3. ScheduledTaskRegistrar: shutdown taskScheduler in destroy() 4. ScheduledAnnotationBeanPostProcessor: do not cancel tasks in destroy()
1 parent c23b1bd commit 9ee3a73

File tree

4 files changed

+7
-9
lines changed

4 files changed

+7
-9
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ plugins {
33
id 'org.jetbrains.kotlin.jvm' version '1.3.72' apply false
44
id 'org.jetbrains.dokka' version '0.10.1' apply false
55
id 'org.asciidoctor.jvm.convert' version '2.4.0'
6-
id 'io.spring.gradle-enterprise-conventions' version '0.0.2'
6+
// id 'io.spring.gradle-enterprise-conventions' version '0.0.2'
77
id 'io.spring.nohttp' version '0.0.5.RELEASE'
88
id 'de.undercouch.download' version '4.0.0'
99
id 'com.gradle.build-scan' version '3.2'

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version=5.2.8.RELEASE
1+
version=5.2.8.RELEASE-SHUTDOWN
22
org.gradle.jvmargs=-Xmx1536M
33
org.gradle.caching=true
44
org.gradle.parallel=true

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

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -579,16 +579,10 @@ public boolean requiresDestruction(Object bean) {
579579

580580
@Override
581581
public void destroy() {
582+
this.registrar.destroy();
582583
synchronized (this.scheduledTasks) {
583-
Collection<Set<ScheduledTask>> allTasks = this.scheduledTasks.values();
584-
for (Set<ScheduledTask> tasks : allTasks) {
585-
for (ScheduledTask task : tasks) {
586-
task.cancel();
587-
}
588-
}
589584
this.scheduledTasks.clear();
590585
}
591-
this.registrar.destroy();
592586
}
593587

594588
}

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import org.springframework.scheduling.TaskScheduler;
3434
import org.springframework.scheduling.Trigger;
3535
import org.springframework.scheduling.concurrent.ConcurrentTaskScheduler;
36+
import org.springframework.scheduling.concurrent.ExecutorConfigurationSupport;
3637
import org.springframework.scheduling.support.CronTrigger;
3738
import org.springframework.util.Assert;
3839
import org.springframework.util.CollectionUtils;
@@ -551,6 +552,9 @@ public Set<ScheduledTask> getScheduledTasks() {
551552

552553
@Override
553554
public void destroy() {
555+
if (this.taskScheduler instanceof ExecutorConfigurationSupport) {
556+
((ExecutorConfigurationSupport) this.taskScheduler).shutdown();
557+
}
554558
for (ScheduledTask task : this.scheduledTasks) {
555559
task.cancel();
556560
}

0 commit comments

Comments
 (0)