Skip to content

Commit

Permalink
jdoc
Browse files Browse the repository at this point in the history
  • Loading branch information
mvysny committed Oct 18, 2023
1 parent 91134fe commit 31e4cd8
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,9 @@ public VaadinBoot scanTestClasspath() {
* of virtual threads.
* <br/>
* Defaults to true.
* @param useVirtualThreadsIfAvailable if true (default), use virtual threads to
* handle http requests if running on JDK21+
* @return this
*/
@NotNull
public VaadinBoot useVirtualThreadsIfAvailable(boolean useVirtualThreadsIfAvailable) {
Expand Down Expand Up @@ -405,10 +408,15 @@ public void stop(@NotNull String reason) {
@NotNull
private static final Logger log = LoggerFactory.getLogger(VaadinBoot.class);

/**
* Creates a thread pool for Jetty to serve http requests.
* @return the thread pool, may be null if the default one is to be used.
*/
@Nullable
protected ThreadPool newThreadPool() {
if (useVirtualThreadsIfAvailable && Env.getJavaVersion() >= 21) {
log.info("Configuring Jetty to use JVM 21+ virtual threads");
// see https://eclipse.dev/jetty/documentation/jetty-12/programming-guide/index.html#pg-arch-threads-thread-pool-virtual-threads
final QueuedThreadPool threadPool = new QueuedThreadPool();
try {
final Method m = Executors.class.getDeclaredMethod("newVirtualThreadPerTaskExecutor");
Expand Down

0 comments on commit 31e4cd8

Please sign in to comment.