Skip to content

Commit

Permalink
no globals
Browse files Browse the repository at this point in the history
  • Loading branch information
Hellblazer committed Jun 6, 2024
1 parent 890d549 commit e2d375e
Showing 1 changed file with 3 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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;
Expand Down Expand Up @@ -80,7 +71,7 @@ public RouterImpl router(ServerConnectionCache.Builder cacheBuilder, Supplier<Li
LimitsRegistry limitsRegistry, List<ServerInterceptor> interceptors,
Predicate<FernetServerInterceptor.HashedToken> 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());
Expand Down

0 comments on commit e2d375e

Please sign in to comment.