How do you set both port and thread pool using embedded jetty, v 9.1.0

后端 未结 4 2325
猫巷女王i
猫巷女王i 2021-02-20 00:09

I\'m using jetty 9.1.0, embedded, and would like to set both port and ThreadPool. I see a constructor for each, but don\'t see how to use one of those, and then any way to set t

4条回答
  •  南旧
    南旧 (楼主)
    2021-02-20 00:23

    QueuedThreadPool threadPool = new QueuedThreadPool();
    threadPool.setMaxThreads(500);
    
    Server server = new Server(threadPool);
    
    ServerConnector http = new ServerConnector(server, new HttpConnectionFactory(http_config));
    http.setPort(81);
    
    server.addConnector(http);
    

提交回复
热议问题