- // problem: how to both limit thread pool size and
- // pick a random free port - two alternative constructors
- QueuedThreadPool tp = new QueuedThreadPool(1, 1);
- // server = new Server(tp); // ? fails with URI null
- server = new Server(0); // pick a free port number
+ /*
+ * Create a server with a small number of threads; jetty will allocate a
+ * free port
+ */
+ QueuedThreadPool tp = new QueuedThreadPool(4, 1); // max, min
+ server = new Server(tp);
+ // 2 selector threads to handle incoming connections
+ ServerConnector connector = new ServerConnector(server, 0, 2);
+ server.addConnector(connector);