如何更改嵌入式 Jetty 9 中的线程池大小?我们需要任何特定的组件吗?
最佳答案
来自 docs :
The Server instance provides a ThreadPool instance that is the default Executor service other Jetty server components use. The prime configuration of the thread pool is the maximum and minimum size and is set in etc/jetty.xml.
<Configure id="server" class="org.eclipse.jetty.server.Server">
<Set name="threadPool">
<New class="org.eclipse.jetty.util.thread.QueuedThreadPool">
<Set name="minThreads">10</Set>
<Set name="maxThreads">1000</Set>
</New>
</Set>
</Configure>
或者
QueuedThreadPool threadPool = new QueuedThreadPool(100, 10);
Server server = new Server(threadPool);
关于java - 在 Jetty 9 中更改线程池大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18534025/