In 嵌入式Tomcat,我该如何配置请求线程数?
我似乎无法让它发挥作用。我尝试了所有这些但没有成功:
- tomcat.getConnector().setProperty("maxThreads", "20");
- tomcat.getConnector().setAttribute("maxThreads", "20");
- tomcat.getConnector().setAttribute("maxThreads", 20);
如果您希望嵌入式tomcat在20个连接后拒绝新连接,您还应该设置acceptCount属性。因此,下面的代码应该可以工作并在 20 点之后拒绝新连接。
tomcat.getConnector().setAttribute("maxThreads", "20");
tomcat.getConnector().setAttribute("acceptCount", "20");
(查看介绍http://tomcat.apache.org/tomcat-7.0-doc/config/http.html http://tomcat.apache.org/tomcat-7.0-doc/config/http.html)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)