浏览代码

config thread num

三刀 2 年之前
父节点
当前提交
0000347780
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      frameworks/Java/smart-socket/src/main/java/org/smartboot/http/Bootstrap.java

+ 1 - 1
frameworks/Java/smart-socket/src/main/java/org/smartboot/http/Bootstrap.java

@@ -29,7 +29,7 @@ public class Bootstrap {
     static byte[] body = "Hello, World!".getBytes();
 
     public static void main(String[] args) {
-        ExecutorService executorService = new ThreadPoolExecutor(1, 1,
+        ExecutorService executorService = new ThreadPoolExecutor(Runtime.getRuntime().availableProcessors(), Runtime.getRuntime().availableProcessors(),
                 0L, TimeUnit.MILLISECONDS,
                 new ArrayBlockingQueue<>(128), new ThreadPoolExecutor.CallerRunsPolicy());
         HttpRouteHandler routeHandle = new HttpRouteHandler();