From 43e1a379ac1eff32e947f9abd0dcb784a39e8ef2 Mon Sep 17 00:00:00 2001 From: hrj Date: Mon, 12 Apr 2021 07:22:53 +0530 Subject: [PATCH] use an unbounded thread pool mimics the performance with JLHttpServer --- src/main/scala/lc/server/Server.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/scala/lc/server/Server.scala b/src/main/scala/lc/server/Server.scala index 498c3ad..26089f2 100644 --- a/src/main/scala/lc/server/Server.scala +++ b/src/main/scala/lc/server/Server.scala @@ -14,7 +14,7 @@ class Server(port: Int) { implicit val formats: DefaultFormats.type = DefaultFormats val server: HttpServer = HttpServer.create(new InetSocketAddress(port), 32) - server.setExecutor(new java.util.concurrent.ForkJoinPool(Runtime.getRuntime().availableProcessors()*4)) + server.setExecutor(java.util.concurrent.Executors.newCachedThreadPool()) private def getRequestJson(ex: HttpExchange): JValue = { val requestBody = ex.getRequestBody