In Jetty 9 the setThreadPool
method of HttpClient
has been removed. Can anyone suggest an alternative way of doing it in Jetty 9?
This is how I used to do in previous versions of Jetty's HttpClient
:
QueuedThreadPool queuedThreadpool= new QueuedThreadPool(5);
queuedThreadpool.setMinThreads(2);
queuedThreadpool.setName("HttpClient");
httpClient.setThreadPool(queuedThreadpool); // <<<<<<
httpClient.start();
Now you need to use setExecutor(executor)
. A QueuedThreadPool
implements the Executor
interface.
QueuedThreadPool queuedThreadpool= new QueuedThreadPool(5);
queuedThreadpool.setMinThreads(2);
queuedThreadpool.setName("HttpClient");
httpClient.setExecutor(queuedThreadpool);
httpClient.start();