[英]How to add thread pool in Jetty 9.2.24 HttpClient?
在Jetty 9中, HttpClient
的setThreadPool
方法已被刪除。 有人可以在Jetty 9中建議其他方法嗎?
這是我以前在Jetty的HttpClient
版本中所做的:
QueuedThreadPool queuedThreadpool= new QueuedThreadPool(5);
queuedThreadpool.setMinThreads(2);
queuedThreadpool.setName("HttpClient");
httpClient.setThreadPool(queuedThreadpool); // <<<<<<
httpClient.start();
現在,您需要使用setExecutor(executor)
。 QueuedThreadPool
實現了Executor
接口。
QueuedThreadPool queuedThreadpool= new QueuedThreadPool(5);
queuedThreadpool.setMinThreads(2);
queuedThreadpool.setName("HttpClient");
httpClient.setExecutor(queuedThreadpool);
httpClient.start();
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.