diff --git a/webserver/webserver/src/main/java/io/helidon/webserver/ExecutorsFactory.java b/webserver/webserver/src/main/java/io/helidon/webserver/ExecutorsFactory.java index 12256bb016d..07bf2a26aef 100644 --- a/webserver/webserver/src/main/java/io/helidon/webserver/ExecutorsFactory.java +++ b/webserver/webserver/src/main/java/io/helidon/webserver/ExecutorsFactory.java @@ -16,12 +16,13 @@ package io.helidon.webserver; -import io.helidon.common.task.HelidonTaskExecutor; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.ThreadFactory; -/** +import io.helidon.common.task.HelidonTaskExecutor; + +/** * Encapsulates operations with {@link Executors}. Helps to workaround * limitations of GraalVM for JDK21 which doesn't support execution of * virtual threads and Graal.js code together. New versions of GraalVM @@ -38,7 +39,8 @@ final class ExecutorsFactory { private ExecutorsFactory() { } - /** Used by {@link LoomServer} to allocate its executor service. + /** + * Used by {@link LoomServer} to allocate its executor service. * * @return {@link Executors#newVirtualThreadPerTaskExecutor()} */ @@ -46,7 +48,8 @@ static ExecutorService newLoomServerVirtualThreadPerTaskExecutor() { return Executors.newVirtualThreadPerTaskExecutor(); } - /** Used by {@link ServerListener} to allocate its reader executor. + /** + * Used by {@link ServerListener} to allocate its reader executor. * * @return {@link ThreadPerTaskExecutor#create(java.util.concurrent.ThreadFactory)} */ @@ -54,7 +57,8 @@ static HelidonTaskExecutor newServerListenerReaderExecutor() { return ThreadPerTaskExecutor.create(virtualThreadFactory()); } - /** Used by {@link ServerListener} to allocate its shared executor. + /** + * Used by {@link ServerListener} to allocate its shared executor. * * @return {@link Executors#newThreadPerTaskExecutor(java.util.concurrent.ThreadFactory)}. */ @@ -62,7 +66,6 @@ static ExecutorService newServerListenerSharedExecutor() { return Executors.newThreadPerTaskExecutor(virtualThreadFactory()); } - private static ThreadFactory virtualThreadFactory() { return Thread.ofVirtual().factory(); } diff --git a/webserver/webserver/src/main/java/io/helidon/webserver/LoomServer.java b/webserver/webserver/src/main/java/io/helidon/webserver/LoomServer.java index 52bfb9d3202..ee5e28c6f6b 100644 --- a/webserver/webserver/src/main/java/io/helidon/webserver/LoomServer.java +++ b/webserver/webserver/src/main/java/io/helidon/webserver/LoomServer.java @@ -25,7 +25,6 @@ import java.util.Timer; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; import java.util.concurrent.Future; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; diff --git a/webserver/webserver/src/main/java/io/helidon/webserver/ServerListener.java b/webserver/webserver/src/main/java/io/helidon/webserver/ServerListener.java index 118ee8ac54b..31e3fd9e799 100644 --- a/webserver/webserver/src/main/java/io/helidon/webserver/ServerListener.java +++ b/webserver/webserver/src/main/java/io/helidon/webserver/ServerListener.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2023 Oracle and/or its affiliates. + * Copyright (c) 2022, 2024 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,7 +34,6 @@ import java.util.concurrent.CompletableFuture; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; import java.util.concurrent.RejectedExecutionException; import java.util.concurrent.Semaphore; import java.util.concurrent.TimeUnit; @@ -60,7 +59,6 @@ import static java.lang.System.Logger.Level.ERROR; import static java.lang.System.Logger.Level.INFO; import static java.lang.System.Logger.Level.TRACE; -import java.util.concurrent.ThreadFactory; class ServerListener implements ListenerContext { private static final System.Logger LOGGER = System.getLogger(ServerListener.class.getName());