mirror of
https://github.com/zongzibinbin/MallChat.git
synced 2026-03-13 21:53:41 +08:00
Merge pull request #39 from TH1nker2/main
netty服务的worker的EventLoopGroup大小根据当前cpu核心数动态获取
This commit is contained in:
@@ -15,6 +15,7 @@ import io.netty.handler.logging.LogLevel;
|
|||||||
import io.netty.handler.logging.LoggingHandler;
|
import io.netty.handler.logging.LoggingHandler;
|
||||||
import io.netty.handler.stream.ChunkedWriteHandler;
|
import io.netty.handler.stream.ChunkedWriteHandler;
|
||||||
import io.netty.handler.timeout.IdleStateHandler;
|
import io.netty.handler.timeout.IdleStateHandler;
|
||||||
|
import io.netty.util.NettyRuntime;
|
||||||
import io.netty.util.concurrent.Future;
|
import io.netty.util.concurrent.Future;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
@@ -28,7 +29,7 @@ public class NettyWebSocketServer {
|
|||||||
public static final int WEB_SOCKET_PORT = 8090;
|
public static final int WEB_SOCKET_PORT = 8090;
|
||||||
// 创建线程池执行器
|
// 创建线程池执行器
|
||||||
private EventLoopGroup bossGroup = new NioEventLoopGroup(1);
|
private EventLoopGroup bossGroup = new NioEventLoopGroup(1);
|
||||||
private EventLoopGroup workerGroup = new NioEventLoopGroup(8);
|
private EventLoopGroup workerGroup = new NioEventLoopGroup(NettyRuntime.availableProcessors());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 启动 ws server
|
* 启动 ws server
|
||||||
|
|||||||
Reference in New Issue
Block a user