|
@@ -90,6 +90,9 @@ public class NettyServer {
|
|
|
|
|
|
if (useMultiThread) {
|
|
|
// linux系统下使用SO_REUSEPORT特性,使得多个线程绑定同一个端口
|
|
|
+ if(workThreadNum<=0) {
|
|
|
+ workThreadNum = Runtime.getRuntime().availableProcessors();
|
|
|
+ }
|
|
|
log.info("使用 epoll reuseport,启动线程数:{}", workThreadNum);
|
|
|
for (int i = 0; i < workThreadNum; i++) {
|
|
|
ChannelFuture future = bootstrap.bind(host, port).await();
|