未验证 提交 e7fcb284 编写于 作者: D dinglei 提交者: GitHub

Merge pull request #689 from Black-Mamba24/master

[ISSUE #556]Fix useEpollNativeSelector=true Broker Start Exception
...@@ -107,16 +107,16 @@ public class NettyRemotingServer extends NettyRemotingAbstract implements Remoti ...@@ -107,16 +107,16 @@ public class NettyRemotingServer extends NettyRemotingAbstract implements Remoti
} }
}); });
this.eventLoopGroupBoss = new NioEventLoopGroup(1, new ThreadFactory() { if (useEpoll()) {
private AtomicInteger threadIndex = new AtomicInteger(0); this.eventLoopGroupBoss = new EpollEventLoopGroup(1, new ThreadFactory() {
private AtomicInteger threadIndex = new AtomicInteger(0);
@Override @Override
public Thread newThread(Runnable r) { public Thread newThread(Runnable r) {
return new Thread(r, String.format("NettyBoss_%d", this.threadIndex.incrementAndGet())); return new Thread(r, String.format("NettyEPOLLBoss_%d", this.threadIndex.incrementAndGet()));
} }
}); });
if (useEpoll()) {
this.eventLoopGroupSelector = new EpollEventLoopGroup(nettyServerConfig.getServerSelectorThreads(), new ThreadFactory() { this.eventLoopGroupSelector = new EpollEventLoopGroup(nettyServerConfig.getServerSelectorThreads(), new ThreadFactory() {
private AtomicInteger threadIndex = new AtomicInteger(0); private AtomicInteger threadIndex = new AtomicInteger(0);
private int threadTotal = nettyServerConfig.getServerSelectorThreads(); private int threadTotal = nettyServerConfig.getServerSelectorThreads();
...@@ -127,6 +127,15 @@ public class NettyRemotingServer extends NettyRemotingAbstract implements Remoti ...@@ -127,6 +127,15 @@ public class NettyRemotingServer extends NettyRemotingAbstract implements Remoti
} }
}); });
} else { } else {
this.eventLoopGroupBoss = new NioEventLoopGroup(1, new ThreadFactory() {
private AtomicInteger threadIndex = new AtomicInteger(0);
@Override
public Thread newThread(Runnable r) {
return new Thread(r, String.format("NettyNIOBoss_%d", this.threadIndex.incrementAndGet()));
}
});
this.eventLoopGroupSelector = new NioEventLoopGroup(nettyServerConfig.getServerSelectorThreads(), new ThreadFactory() { this.eventLoopGroupSelector = new NioEventLoopGroup(nettyServerConfig.getServerSelectorThreads(), new ThreadFactory() {
private AtomicInteger threadIndex = new AtomicInteger(0); private AtomicInteger threadIndex = new AtomicInteger(0);
private int threadTotal = nettyServerConfig.getServerSelectorThreads(); private int threadTotal = nettyServerConfig.getServerSelectorThreads();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册