How to solve the linear security problem of servlet?

servlet defaults to single-instance multithreading mode, so linear security problems may occur. One solution is to implement the SingleThreadModel interface, but this method is not recommended. It is said that this method consumes a lot of memory resources when the concurrency is high. (because the implementation of this interface, that is, each request, will create a servlet instance, which is multiple instances, which will take up a lot of memory),. But isn"t it the default in struts2 to create an action for every request? why doesn"t anyone say that struts2 consumes a lot of memory resources?

Mar.28,2021

the thread safety problem is that there is a shared state, as long as the servlet member variables are not shared, or as long as the member variables are set for the correct Synchronize, there is no thread safety problem.

Menu