Skip to content

Commit 323de12

Browse files
committed
Document limited support for lifecycle management
Closes gh-33780
1 parent 94d46eb commit 323de12

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

Diff for: spring-context/src/main/java/org/springframework/scheduling/concurrent/SimpleAsyncTaskScheduler.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,9 @@
7878
* but rather just the hand-off to an execution thread.</b> As a consequence,
7979
* a {@link ScheduledFuture} handle (e.g. from {@link #schedule(Runnable, Instant)})
8080
* represents that hand-off rather than the actual completion of the provided task
81-
* (or series of repeated tasks).
81+
* (or series of repeated tasks). Also, this scheduler participates in lifecycle
82+
* management to a limited degree only, stopping trigger firing and fixed-delay
83+
* task execution but not stopping the execution of handed-off tasks.
8284
*
8385
* <p>As an alternative to the built-in thread-per-task capability, this scheduler
8486
* can also be configured with a separate target executor for scheduled task

Diff for: spring-core/src/main/java/org/springframework/core/task/SimpleAsyncTaskExecutor.java

+5
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@
4646
* executing a large number of short-lived tasks. Alternatively, on JDK 21,
4747
* consider setting {@link #setVirtualThreads} to {@code true}.
4848
*
49+
* <p><b>NOTE: This executor does not participate in context-level lifecycle
50+
* management.</b> Tasks on handed-off execution threads cannot be centrally
51+
* stopped and restarted; if such tight lifecycle management is necessary,
52+
* consider a common {@code ThreadPoolTaskExecutor} setup instead.
53+
*
4954
* @author Juergen Hoeller
5055
* @since 2.0
5156
* @see #setVirtualThreads

0 commit comments

Comments
 (0)