From e2d375eaf99b8f4d62dc155918ff829189afc4a7 Mon Sep 17 00:00:00 2001 From: Hellblazer Date: Thu, 6 Jun 2024 15:43:23 -0700 Subject: [PATCH] no globals --- .../apollo/archipelago/LocalServer.java | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/memberships/src/main/java/com/salesforce/apollo/archipelago/LocalServer.java b/memberships/src/main/java/com/salesforce/apollo/archipelago/LocalServer.java index 822b4c79f..530f0e90a 100644 --- a/memberships/src/main/java/com/salesforce/apollo/archipelago/LocalServer.java +++ b/memberships/src/main/java/com/salesforce/apollo/archipelago/LocalServer.java @@ -27,7 +27,6 @@ import java.util.List; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; -import java.util.concurrent.ThreadPoolExecutor; import java.util.function.Predicate; import java.util.function.Supplier; @@ -38,16 +37,8 @@ * @author hal.hildebrand */ public class LocalServer implements RouterSupplier { - private static final Logger log = LoggerFactory.getLogger(LocalServer.class); - private static final String NAME_TEMPLATE = "%s-%s"; - private static final ExecutorService PLATFORM; - - static { - PLATFORM = Executors.newCachedThreadPool(); - var platform = (ThreadPoolExecutor) PLATFORM; - platform.setCorePoolSize(Runtime.getRuntime().availableProcessors()); - platform.prestartAllCoreThreads(); - } + private static final Logger log = LoggerFactory.getLogger(LocalServer.class); + private static final String NAME_TEMPLATE = "%s-%s"; private final ClientInterceptor clientInterceptor; private final Member from; @@ -80,7 +71,7 @@ public RouterImpl router(ServerConnectionCache.Builder cacheBuilder, Supplier
  • interceptors, Predicate validator, ExecutorService executor) { if (executor == null) { - executor = PLATFORM; + executor = Executors.newVirtualThreadPerTaskExecutor(); } String name = String.format(NAME_TEMPLATE, prefix, qb64(from.getId())); var limitsBuilder = new GrpcServerLimiterBuilder().limit(serverLimit.get());