|
21 | 21 | import org.springframework.beans.factory.ObjectProvider;
|
22 | 22 | import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
23 | 23 | import org.springframework.boot.autoconfigure.condition.ConditionalOnThreading;
|
24 |
| -import org.springframework.boot.autoconfigure.task.TaskExecutionProperties.Shutdown; |
25 | 24 | import org.springframework.boot.autoconfigure.thread.Threading;
|
26 | 25 | import org.springframework.boot.task.SimpleAsyncTaskExecutorBuilder;
|
27 | 26 | import org.springframework.boot.task.SimpleAsyncTaskExecutorCustomizer;
|
@@ -92,7 +91,7 @@ TaskExecutorBuilder taskExecutorBuilder(TaskExecutionProperties properties,
|
92 | 91 | builder = builder.maxPoolSize(pool.getMaxSize());
|
93 | 92 | builder = builder.allowCoreThreadTimeOut(pool.isAllowCoreThreadTimeout());
|
94 | 93 | builder = builder.keepAlive(pool.getKeepAlive());
|
95 |
| - Shutdown shutdown = properties.getShutdown(); |
| 94 | + TaskExecutionProperties.Shutdown shutdown = properties.getShutdown(); |
96 | 95 | builder = builder.awaitTermination(shutdown.isAwaitTermination());
|
97 | 96 | builder = builder.awaitTerminationPeriod(shutdown.getAwaitTerminationPeriod());
|
98 | 97 | builder = builder.threadNamePrefix(properties.getThreadNamePrefix());
|
@@ -120,7 +119,7 @@ ThreadPoolTaskExecutorBuilder threadPoolTaskExecutorBuilder(TaskExecutionPropert
|
120 | 119 | builder = builder.maxPoolSize(pool.getMaxSize());
|
121 | 120 | builder = builder.allowCoreThreadTimeOut(pool.isAllowCoreThreadTimeout());
|
122 | 121 | builder = builder.keepAlive(pool.getKeepAlive());
|
123 |
| - Shutdown shutdown = properties.getShutdown(); |
| 122 | + TaskExecutionProperties.Shutdown shutdown = properties.getShutdown(); |
124 | 123 | builder = builder.awaitTermination(shutdown.isAwaitTermination());
|
125 | 124 | builder = builder.awaitTerminationPeriod(shutdown.getAwaitTerminationPeriod());
|
126 | 125 | builder = builder.threadNamePrefix(properties.getThreadNamePrefix());
|
@@ -177,8 +176,10 @@ private SimpleAsyncTaskExecutorBuilder builder() {
|
177 | 176 | builder = builder.taskDecorator(this.taskDecorator.getIfUnique());
|
178 | 177 | TaskExecutionProperties.Simple simple = this.properties.getSimple();
|
179 | 178 | builder = builder.concurrencyLimit(simple.getConcurrencyLimit());
|
180 |
| - Shutdown shutdown = this.properties.getShutdown(); |
181 |
| - builder = builder.taskTerminationTimeout(shutdown.getAwaitTerminationPeriod()); |
| 179 | + TaskExecutionProperties.Shutdown shutdown = this.properties.getShutdown(); |
| 180 | + if (shutdown.isAwaitTermination()) { |
| 181 | + builder = builder.taskTerminationTimeout(shutdown.getAwaitTerminationPeriod()); |
| 182 | + } |
182 | 183 | return builder;
|
183 | 184 | }
|
184 | 185 |
|
|
0 commit comments