【问题标题】:Embedded Tomcat: how to configure the number of request threads嵌入式Tomcat:如何配置请求线程数
【发布时间】:2013-05-30 23:45:35
【问题描述】:

Embedded Tomcat中,如何配置请求线程数

我似乎无法让它工作。我尝试了所有这些都没有成功:

  • tomcat.getConnector().setProperty("maxThreads", "20");
  • tomcat.getConnector().setAttribute("maxThreads", "20");
  • tomcat.getConnector().setAttribute("maxThreads", 20);

【问题讨论】:

    标签: tomcat embedded-tomcat-7


    【解决方案1】:

    如果你想让嵌入式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的介绍)

    ​​>

    【讨论】:

      猜你喜欢
      • 2021-04-30
      • 2013-08-27
      • 2016-10-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-08-03
      • 1970-01-01
      • 2015-10-30
      相关资源
      最近更新 更多