NettyServer.java 文件源码

java
阅读 31 收藏 0 点赞 0 评论 0

项目:nfs-rpc 作者:
public void start(int listenPort, final ExecutorService threadPool) throws Exception {
  if (!startFlag.compareAndSet(false, true)) {
    return;
  }
  bootstrap.setPipelineFactory(new ChannelPipelineFactory() {
    public ChannelPipeline getPipeline() throws Exception {
      ChannelPipeline pipeline = new DefaultChannelPipeline();
      pipeline.addLast("decoder", new NettyProtocolDecoder());
      pipeline.addLast("encoder", new NettyProtocolEncoder());
      pipeline.addLast("handler", new NettyServerHandler(threadPool));
      return pipeline;
    }
  });
  bootstrap.bind(new InetSocketAddress(listenPort));
  LOGGER.warn("Server started,listen at: " + listenPort);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号