Skip to content
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

#11353 offer named virtual thread executor #11430

Merged
merged 2 commits into from
Feb 21, 2024
Merged

#11353 offer named virtual thread executor #11430

merged 2 commits into from
Feb 21, 2024

Conversation

danishnawab
Copy link
Contributor

Implements #11353 (comment).

Add VirtualThreads.getNamedVirtualThreadsExecutor(String namePrefix) as a commodity to be used by users/libraries.

This PR supersedes #11355

}
catch (Throwable x)
{
return null;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be consistent with the existing API style (e.g. getDefaultVirtualThreadsExecutor), I return null here instead of propagating the exception.
Since org.eclipse.jetty.util.VirtualThreads.Configurable#setVirtualThreadsExecutor checks for virtual thread support as well as executor (and throws an UnsupportedOperationException otherwise), we should be fine here.

@sbordet sbordet linked an issue Feb 21, 2024 that may be closed by this pull request
@sbordet sbordet requested a review from gregw February 21, 2024 18:49
@sbordet
Copy link
Contributor

sbordet commented Feb 21, 2024

@gregw please review this contribution.

We now have a utility method that can be used by e.g. Spring to name virtual threads (see #11353 for the Spring usages).

@sbordet sbordet merged commit f860175 into jetty:jetty-12.0.x Feb 21, 2024
8 checks passed
@sbordet
Copy link
Contributor

sbordet commented Feb 21, 2024

@danishnawab Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

The default virtual thread executor should created named threads
3 participants