mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-10-07 23:49:08 +00:00
Reliably unpause execution thread in case of late shutdown
Closes gh-37406
This commit is contained in:
+3
@@ -366,6 +366,9 @@ public abstract class ExecutorConfigurationSupport extends CustomizableThreadFac
|
||||
logger.debug("Shutting down ExecutorService" + (this.beanName != null ? " '" + this.beanName + "'" : ""));
|
||||
}
|
||||
if (this.executor != null) {
|
||||
if (this.lifecycleDelegate != null && this.lateShutdown) {
|
||||
this.lifecycleDelegate.markShutdown();
|
||||
}
|
||||
if (this.waitForTasksToCompleteOnShutdown) {
|
||||
this.executor.shutdown();
|
||||
}
|
||||
|
||||
+8
-1
@@ -104,7 +104,14 @@ final class ExecutorLifecycleDelegate implements SmartLifecycle {
|
||||
}
|
||||
|
||||
void markShutdown() {
|
||||
this.shutdown = true;
|
||||
this.pauseLock.lock();
|
||||
try {
|
||||
this.shutdown = true;
|
||||
this.unpaused.signalAll();
|
||||
}
|
||||
finally {
|
||||
this.pauseLock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
void beforeExecute(Thread thread) {
|
||||
|
||||
Reference in New Issue
Block a user