From 01c85b1afbe18571e0144fad0c1a8fd3a4369079 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Wed, 13 Nov 2024 15:09:02 +0100 Subject: [PATCH] Add explicit note on blocking in case of concurrency limit Closes gh-33873 --- .../springframework/core/task/SimpleAsyncTaskExecutor.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/spring-core/src/main/java/org/springframework/core/task/SimpleAsyncTaskExecutor.java b/spring-core/src/main/java/org/springframework/core/task/SimpleAsyncTaskExecutor.java index 8412e6c4aff9..def172a7ed41 100644 --- a/spring-core/src/main/java/org/springframework/core/task/SimpleAsyncTaskExecutor.java +++ b/spring-core/src/main/java/org/springframework/core/task/SimpleAsyncTaskExecutor.java @@ -196,6 +196,11 @@ public void setTaskTerminationTimeout(long timeout) { * The default of -1 indicates no concurrency limit at all. *

This is the equivalent of a maximum pool size in a thread pool, * preventing temporary overload of the thread management system. + * However, in contrast to a thread pool with a managed task queue, + * this executor will block the submitter until the task can be + * accepted when the configured concurrency limit has been reached. + * If you prefer queue-based task hand-offs without such blocking, + * consider using a {@code ThreadPoolTaskExecutor} instead. * @see #UNBOUNDED_CONCURRENCY * @see org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor#setMaxPoolSize */