@Override
public void start() {
this.bossGroup = NettyUtils.createEventLoopGroup(1);
this.workerGroup = NettyUtils.createEventLoopGroup(4);
Class<? extends ServerChannel> serverChannelClass = NettyUtils.getServerChannelClass();
this.logger.info("I am going to start a server on {}:{}.", this.config.getServerHost(),
this.config.getServerPort());
ServerBootstrap serverBootstrap = new ServerBootstrap();
try {
channel = serverBootstrap
.group(bossGroup, workerGroup)
.channel(serverChannelClass)
.childHandler(new ServerChannelInitializer(this))
.childOption(ChannelOption.SO_KEEPALIVE, true)
.bind(config.getServerHost(), config.getServerPort())
.sync().channel();
} catch (InterruptedException e) {
e.printStackTrace();
}
this.logger.info("Started the server on {}:{}.", this.config.getServerHost(),
this.config.getServerPort());
}
SimpleEchidnaServer.java 文件源码
java
阅读 65
收藏 0
点赞 0
评论 0
项目:echidna
作者:
评论列表
文章目录