1

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();
Jeffrey Chung
  • 19,319
  • 8
  • 34
  • 54
Dipankar Dey
  • 105
  • 1
  • 8

1 Answers1

0

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();
ᴇʟᴇvᴀтᴇ
  • 12,285
  • 4
  • 43
  • 66