Configuring Tomcat only for raising one servlet per application

In my understanding, Tomcat is allowed to collect as many copies of the servlet as it wants to serve requests.

This causes my servlets to not have a severe state and instead store all the state in the context (singleton) of the servlet.

Is it possible to configure Tomcat to treat my servlets as single elements and always lift exactly one servlet instance regardless of load?

+3
source share
4 answers

According to the servlet specification (v2.4, section 2.2 "Number of Instances"):

SRV.2.2 Number of instances

, ( ), . SingleThreadModel, .

: SingleThreadModel web.xml.

+11

, Servlet, , , , .. , 't , , Session ( Request).

... ? " " - .

+2

, . tomcat , JavaEE . , , MVC .

, , , singleton, .

+1

, . , . . , . , , , .

. .

: , , X, , . .

+1

Source: https://habr.com/ru/post/1714316/


All Articles