How to use multiple ServerBootstrap objects in Netty

前端 未结 2 635
遇见更好的自我
遇见更好的自我 2021-02-10 09:09

I am trying to use Netty (4.0.24) to create several servers (several ServerBootstraps) in one application (one main method). I saw this question/answer but it leaves many questi

2条回答
  •  佛祖请我去吃肉
    2021-02-10 09:31

    public static void main(String[] args) {
      new Thread(new Runnable(){
        @Override
        public void run() {
          //{...} ServerBootstrap 1
        }
      }).start();
      new Thread(new Runnable(){
        @Override
        public void run() {
          //{...} ServerBootstrap 2
        }
      }).start();
      new Thread(new Runnable(){
        @Override
        public void run() {
          //{...} ServerBootstrap 3
        }
      }).start();
    } 
    

提交回复
热议问题