Last active
December 9, 2022 13:47
-
-
Save GloryAlex/632b0506f24784c83f19e5ade7c7ba78 to your computer and use it in GitHub Desktop.
Mac OS不提供epoll方法,本机测试的话用kqueue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final boolean isMac = | |
System.getProperty("os.name").toLowerCase(Locale.US).contains("mac"); | |
// Configure the server. | |
// See https://netty.io/wiki/native-transports.html | |
EventLoopGroup bossGroup; | |
EventLoopGroup workerGroup; | |
if (isMac) { | |
bossGroup = new io.netty.channel.kqueue.KQueueEventLoopGroup(); | |
workerGroup = new io.netty.channel.kqueue.KQueueEventLoopGroup(5); | |
} else { | |
bossGroup = new io.netty.channel.epoll.EpollEventLoopGroup(); | |
workerGroup = new io.netty.channel.epoll.EpollEventLoopGroup(5); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment