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
You could go with XML configuration from /etc/jetty.xml file, which is well documented and also use beans with Spring configuration.
There's no constructor that will take ThreadPool and port together.
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);
Server server = new Server(new QueuedThreadPool(128, 8));
ServerConnector connector = new ServerConnector(server, new HttpConnectionFactory());
connector.setPort(8897);
server.addConnector(connector);
I can't test it right know, but I assume you can
a) Use a configuration file and load it
or
b) Use the QueuedThreadPool and do the following:
SelectChannelConnector connector = new SelectChannelConnector();
connector.setPort(9090);
server.addConnector(connector);