-
Notifications
You must be signed in to change notification settings - Fork 38.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Configuration options for virtual threads #30241
Comments
A convenient In places where that common executor is used by default, it is easy enough to pass in a specifically configured In addition, a focused virtual-threads-based executor variant for programmatic use seems attractive as well, in particular for explicitly starting virtual threads from JDK 17 based code (in certain code paths) in other parts of the portfolio, without having to compile against JDK 21 in those places. A single such delegate at |
This commit makes sure that the SimpleAsyncTaskExecutor only creates a virtual thread when the virtualThreadDelegate is set, and not an additional kernel thread as well. See gh-30241
@jhoeller based on https://openjdk.org/jeps/444 which recommends "Do not pool virtual threads", the new configuration options will be applicable only to |
Indeed, those options will only be available on |
In addition to our general compatibility effort in #23443, we are going to explore first-class configuration options for virtual threads: e.g. a
virtualThreads
flag onSimpleAsyncTaskExecutor
or a similar dedicated virtual-threadTaskExecutor
implementation with thread naming and concurrency throttle support.We may also introduce virtual thread flags in places where we currently use a
SimpleAsyncTaskExecutor
by default, such as inDefaultMessageListenerContainer
. These facilities can then conveniently be configured for virtual threads on their own (not having to pass a custom ´Executor` for it) and possibly also as part of a wider-ranging virtual thread setup in Spring Boot 3.2.In contrast to #23443, this effort will require some level of building against JDK 21, at least for the
spring-core
module which is likely to centralize the foundational configuration pieces for virtual threads. All other modules would just delegate to those classes/methods on an as-needed basis, without incurring any JDK 21 build requirements or defensive mechanisms for running on JDK 17-20 themselves.The text was updated successfully, but these errors were encountered: