gpt4 book ai didi

java - 在 Jetty 9 中更改线程池大小

转载 作者:IT老高 更新时间:2023-10-28 20:26:38 24 4
gpt4 key购买 nike

如何更改嵌入式 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com