在9号码头 setThreadPool 方法 HttpClient 已删除。有人能建议在Jetty 9中使用其他方法吗?
setThreadPool
HttpClient
这就是我以前在Jetty的版本中所做的 HttpClient :
QueuedThreadPool queuedThreadpool= new QueuedThreadPool(5); queuedThreadpool.setMinThreads(2); queuedThreadpool.setName("HttpClient"); httpClient.setThreadPool(queuedThreadpool); // <<<<<< httpClient.start();
现在您需要使用 setExecutor(executor) . A. QueuedThreadPool 实现 Executor 界面
setExecutor(executor)
QueuedThreadPool
Executor
QueuedThreadPool queuedThreadpool= new QueuedThreadPool(5); queuedThreadpool.setMinThreads(2); queuedThreadpool.setName("HttpClient"); httpClient.setExecutor(queuedThreadpool); httpClient.start();