mirror of
https://github.com/Nan1t/NanoLimbo.git
synced 2025-07-12 20:50:13 +02:00
Added extra params in config for Netty
This commit is contained in:
parent
7ba831d1a6
commit
8404135e42
@ -30,6 +30,10 @@ public final class LimboConfig {
|
||||
private long readTimeout;
|
||||
private int debugLevel = 3;
|
||||
|
||||
private boolean useEpoll;
|
||||
private int bossGroupSize;
|
||||
private int workerGroupSize;
|
||||
|
||||
public LimboConfig(Path root){
|
||||
this.root = root;
|
||||
}
|
||||
@ -59,6 +63,10 @@ public final class LimboConfig {
|
||||
infoForwarding = conf.getNode("infoForwarding").getValue(InfoForwarding.class);
|
||||
readTimeout = conf.getNode("readTimeout").getLong();
|
||||
debugLevel = conf.getNode("debugLevel").getInt();
|
||||
|
||||
useEpoll = conf.getNode("netty", "useEpoll").getBoolean(true);
|
||||
bossGroupSize = conf.getNode("netty", "threads", "bossGroup").getInt(1);
|
||||
workerGroupSize = conf.getNode("netty", "threads", "workerGroup").getInt(4);
|
||||
}
|
||||
|
||||
public SocketAddress getAddress() {
|
||||
@ -112,4 +120,16 @@ public final class LimboConfig {
|
||||
public BossBar getBossBar() {
|
||||
return bossBar;
|
||||
}
|
||||
|
||||
public boolean isUseEpoll() {
|
||||
return useEpoll;
|
||||
}
|
||||
|
||||
public int getBossGroupSize() {
|
||||
return bossGroupSize;
|
||||
}
|
||||
|
||||
public int getWorkerGroupSize() {
|
||||
return workerGroupSize;
|
||||
}
|
||||
}
|
||||
|
@ -80,14 +80,14 @@ public final class LimboServer {
|
||||
private void startBootstrap(){
|
||||
Class<? extends ServerChannel> channelClass;
|
||||
|
||||
if (Epoll.isAvailable()){
|
||||
bossGroup = new EpollEventLoopGroup(1);
|
||||
workerGroup = new EpollEventLoopGroup(4);
|
||||
if (config.isUseEpoll() && Epoll.isAvailable()){
|
||||
bossGroup = new EpollEventLoopGroup(config.getBossGroupSize());
|
||||
workerGroup = new EpollEventLoopGroup(config.getWorkerGroupSize());
|
||||
channelClass = EpollServerSocketChannel.class;
|
||||
Logger.debug("Using Epoll transport type");
|
||||
} else {
|
||||
bossGroup = new NioEventLoopGroup(1);
|
||||
workerGroup = new NioEventLoopGroup(4);
|
||||
bossGroup = new NioEventLoopGroup(config.getBossGroupSize());
|
||||
workerGroup = new NioEventLoopGroup(config.getWorkerGroupSize());
|
||||
channelClass = NioServerSocketChannel.class;
|
||||
Logger.debug("Using Java NIO transport type");
|
||||
}
|
||||
|
@ -65,3 +65,12 @@ readTimeout: 30000
|
||||
# 2 - Display info and warnings
|
||||
# 3 - Display info, warnings, errors
|
||||
debugLevel: 3
|
||||
|
||||
# Warning! Do not touch params of this block, if you not completely sure what is this!
|
||||
netty:
|
||||
# Use Linux native transport type, if it possible
|
||||
useEpoll: true
|
||||
# EventLoopGroup threads count
|
||||
threads:
|
||||
bossGroup: 1
|
||||
workerGroup: 4
|
Loading…
x
Reference in New Issue
Block a user