diff --git a/mallchat-custom-server/src/main/java/com/abin/mallchat/custom/user/websocket/NettyWebSocketServer.java b/mallchat-custom-server/src/main/java/com/abin/mallchat/custom/user/websocket/NettyWebSocketServer.java index fb9d912..ace0ac2 100644 --- a/mallchat-custom-server/src/main/java/com/abin/mallchat/custom/user/websocket/NettyWebSocketServer.java +++ b/mallchat-custom-server/src/main/java/com/abin/mallchat/custom/user/websocket/NettyWebSocketServer.java @@ -15,6 +15,7 @@ import io.netty.handler.logging.LogLevel; import io.netty.handler.logging.LoggingHandler; import io.netty.handler.stream.ChunkedWriteHandler; import io.netty.handler.timeout.IdleStateHandler; +import io.netty.util.NettyRuntime; import io.netty.util.concurrent.Future; import lombok.extern.slf4j.Slf4j; import org.springframework.context.annotation.Configuration; @@ -28,7 +29,7 @@ public class NettyWebSocketServer { public static final int WEB_SOCKET_PORT = 8090; // 创建线程池执行器 private EventLoopGroup bossGroup = new NioEventLoopGroup(1); - private EventLoopGroup workerGroup = new NioEventLoopGroup(8); + private EventLoopGroup workerGroup = new NioEventLoopGroup(NettyRuntime.availableProcessors()); /** * 启动 ws server