Axel Fontaine
Axel Fontaine

Reputation: 35169

Embedded Tomcat: how to configure the number of request threads

In Embedded Tomcat, how can I configure the number of request threads?

I can't seem to get it to work. I tried all of these without success:

Upvotes: 2

Views: 2033

Answers (1)

jdiver
jdiver

Reputation: 2348

If you want embedded tomcat to refuse new connections after 20 connections, you should also set acceptCount attribute. So, below code should work and refuse new connections after 20.

tomcat.getConnector().setAttribute("maxThreads", "20");
tomcat.getConnector().setAttribute("acceptCount", "20");

(check the introduction on http://tomcat.apache.org/tomcat-7.0-doc/config/http.html)

Upvotes: 1

Related Questions