Skip to content

AbstractServerFactory.enableVirtualThreads does not properly configure Jetty for virtual threads  #9308

@twbecker

Description

@twbecker

The enableVirtualThreads setting was added in #7134 to "Support Project Loom in Jetty 10 & JDK 17+". The documentation for this setting says it "enables virtual threads for Jetty’s thread pool." Setting that flag to true simply causes Jetty's QueuedThreadPool to be backed by a virtual thread executor. This not only causes the virtual threads to be pooled, which is an anti-pattern, but also bypasses Jetty's built-in support for virtual threads. Instead, Jetty recommends creating the thread pool as normal and setting a virtual thread executor via QueuedThreadPool.setVirtualThreadsExecutor().

I think AbstractServerFactory should be reworked to configure Jetty as described when this flag is set. I'm not aware of any use-case where the current behavior would be desired.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions