-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Provide a possibility to name virtual threads #8863
Comments
A setter on The solution may be to have a |
Or maybe a setter for the name on the |
@gregw @dzikoysk I don't want to commit Jetty to Java preview APIs that could go on for years and change considerably in every Java version, so we would have Jetty methods that work on Java 19, but don't work on Java 20, but maybe they work again on Java 21, who knows. We have already done this for the Java foreign APIs and it's a different Jetty module for every Java version. The current approach is to do the minimum possible to support virtual threads, with minimal exposure to users. For now it is just a boolean When virtual threads will be finalized, I'm all for better configurability, but for now I'd like to have the minimum possible exposure. |
If you'd open access to this field a little bit (by setter or sth) it'd be enough for me to inject my instance of |
Having a setter for an What exact problem do you have with thread names? |
If someone will pass other executor impl to setter called We'd like to migrate to built-in Loom support in QueuedThreadPool in Javalin: So we can reduce impl on our side + return QueuedThreadPool (that implements Lifecycle with start/stop) instead of ThreadPool instance. |
Reworked the VirtualThreads APIs to be based on Executor rather than just boolean. Signed-off-by: Simone Bordet <[email protected]>
@dzikoysk can you try branch |
Reworked the VirtualThreads APIs to be based on Executor rather than just boolean. Signed-off-by: Simone Bordet <[email protected]>
Thanks, I like that I can pass my own instance of |
Enhancement Description
Jetty 11 supports Loom, but we don't have any control over the used executor:
https://github.com/eclipse/jetty.project/blob/1e0ef57bb4656b7e5e29bf38b1c7a2772e2d0a2a/jetty-util/src/main/java/org/eclipse/jetty/util/VirtualThreads.java#L34-L41
We should be able to customize executor using
OfVirtual
:To e.g. name virtual threads (currently it looks like
VirtualThread[#349]/runnable@ForkJoinPool-1-worker-5
). Would be nice, if Jetty could provide an abstraction over this builder or just provide a possibility to manually assign customized instance. Currently it's not possible, because this field is final, so some kind of a setter could be an option.The text was updated successfully, but these errors were encountered: