在Jetty 9中更改线程池大小 [英] Change thread pool size in Jetty 9

查看:759
本文介绍了在Jetty 9中更改线程池大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在嵌入式Jetty 9中更改线程池大小?我们需要任何特定的组件吗?

How can I change thread pool size in embedded Jetty 9? Do we need any specific component for this?

推荐答案

来自 docs


服务器instance提供了一个ThreadPool实例,它是其他Jetty服务器组件使用的默认
Executor服务。线程池的主要
配置是最大和最小大小,并且在etc / jetty.xml中设置

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);

这篇关于在Jetty 9中更改线程池大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆