1
1
/*
2
- * Copyright 2002-2023 the original author or authors.
2
+ * Copyright 2002-2024 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -91,7 +91,7 @@ public abstract class ExecutorConfigurationSupport extends CustomizableThreadFac
91
91
92
92
/**
93
93
* Set the ThreadFactory to use for the ExecutorService's thread pool.
94
- * Default is the underlying ExecutorService's default thread factory.
94
+ * THe default is the underlying ExecutorService's default thread factory.
95
95
* <p>In a Jakarta EE or other managed environment with JSR-236 support,
96
96
* consider specifying a JNDI-located ManagedThreadFactory: by default,
97
97
* to be found at "java:comp/DefaultManagedThreadFactory".
@@ -115,7 +115,7 @@ public void setThreadNamePrefix(@Nullable String threadNamePrefix) {
115
115
116
116
/**
117
117
* Set the RejectedExecutionHandler to use for the ExecutorService.
118
- * Default is the ExecutorService's default abort policy.
118
+ * The default is the ExecutorService's default abort policy.
119
119
* @see java.util.concurrent.ThreadPoolExecutor.AbortPolicy
120
120
*/
121
121
public void setRejectedExecutionHandler (@ Nullable RejectedExecutionHandler rejectedExecutionHandler ) {
@@ -126,19 +126,25 @@ public void setRejectedExecutionHandler(@Nullable RejectedExecutionHandler rejec
126
126
/**
127
127
* Set whether to accept further tasks after the application context close phase
128
128
* has begun.
129
- * <p>Default is {@code false} as of 6.1, triggering an early soft shutdown of
129
+ * <p>The default is {@code false} as of 6.1, triggering an early soft shutdown of
130
130
* the executor and therefore rejecting any further task submissions. Switch this
131
131
* to {@code true} in order to let other components submit tasks even during their
132
132
* own stop and destruction callbacks, at the expense of a longer shutdown phase.
133
133
* The executor will not go through a coordinated lifecycle stop phase then
134
- * but rather only stop tasks on its own shutdown. This usually goes along with
135
- * {@link #setWaitForTasksToCompleteOnShutdown "waitForTasksToCompleteOnShutdown"}.
134
+ * but rather only stop tasks on its own shutdown.
135
+ * <p>{@code acceptTasksAfterContextClose=true} like behavior also follows from
136
+ * {@link #setWaitForTasksToCompleteOnShutdown "waitForTasksToCompleteOnShutdown"}
137
+ * which effectively is a specific variant of this flag, replacing the early soft
138
+ * shutdown in the concurrent managed stop phase with a serial soft shutdown in
139
+ * the executor's destruction step, with individual awaiting according to the
140
+ * {@link #setAwaitTerminationSeconds "awaitTerminationSeconds"} property.
136
141
* <p>This flag will only have effect when the executor is running in a Spring
137
142
* application context and able to receive the {@link ContextClosedEvent}.
138
143
* @since 6.1
139
144
* @see org.springframework.context.ConfigurableApplicationContext#close()
140
145
* @see DisposableBean#destroy()
141
146
* @see #shutdown()
147
+ * @see #setAwaitTerminationSeconds
142
148
*/
143
149
public void setAcceptTasksAfterContextClose (boolean acceptTasksAfterContextClose ) {
144
150
this .acceptTasksAfterContextClose = acceptTasksAfterContextClose ;
@@ -147,8 +153,8 @@ public void setAcceptTasksAfterContextClose(boolean acceptTasksAfterContextClose
147
153
/**
148
154
* Set whether to wait for scheduled tasks to complete on shutdown,
149
155
* not interrupting running tasks and executing all tasks in the queue.
150
- * <p>Default is {@code false}, with a coordinated lifecycle stop first (unless
151
- * {@link #setAcceptTasksAfterContextClose "acceptTasksAfterContextClose"}
156
+ * <p>The default is {@code false}, with a coordinated lifecycle stop first
157
+ * (unless {@link #setAcceptTasksAfterContextClose "acceptTasksAfterContextClose"}
152
158
* has been set) and then an immediate shutdown through interrupting ongoing
153
159
* tasks and clearing the queue. Switch this flag to {@code true} if you
154
160
* prefer fully completed tasks at the expense of a longer shutdown phase.
@@ -162,6 +168,8 @@ public void setAcceptTasksAfterContextClose(boolean acceptTasksAfterContextClose
162
168
* property instead of or in addition to this property.
163
169
* @see java.util.concurrent.ExecutorService#shutdown()
164
170
* @see java.util.concurrent.ExecutorService#shutdownNow()
171
+ * @see #shutdown()
172
+ * @see #setAwaitTerminationSeconds
165
173
*/
166
174
public void setWaitForTasksToCompleteOnShutdown (boolean waitForJobsToCompleteOnShutdown ) {
167
175
this .waitForTasksToCompleteOnShutdown = waitForJobsToCompleteOnShutdown ;
@@ -326,7 +334,7 @@ public void shutdown() {
326
334
}
327
335
328
336
/**
329
- * Cancel the given remaining task which never commended execution,
337
+ * Cancel the given remaining task which never commenced execution,
330
338
* as returned from {@link ExecutorService#shutdownNow()}.
331
339
* @param task the task to cancel (typically a {@link RunnableFuture})
332
340
* @since 5.0.5
0 commit comments