[JAVA] Servlet movement

References

This article was written with reference to the following information. -Servlet from the basics / JSP new version

Servlet movement

When the Servlet is started, the application server reads the Servlet class file, creates an instance of the Servlet in memory, and executes the Servlet. Once you start the Servlet, reuse the started Servlet.

point **-Reuse one instance instead of creating an instance for each user. ** ** **-Process each user's request in parallel using multithreading. ** **

In other words Multiple threads may operate resources such as variables at the same time.

Below, the memory management image for each variable

variable Heap area Shared between threads
Class variables instance ◯ will be
Instance variables instance ◯ will be
Local variables JAVA stack(Thread-specific area) × Not done

★ Remember ** When working with instance variables and class variables, you need to consider the issue of concurrent operations. ** **

Recommended Posts

Servlet movement
Servlet
insert servlet
[Java] Servlet filter
[Servlet] Basic method