The Servlet Life Cycle
These are the life cycle phases of a Servlet:
- Load the servlet class.
- Create an instance of the servlet.
- Call the servlet's
init() method.
- Call the servlet's
service() method for each request. Repeat indefinitely. Multiple threads may call concurrently!
- Call the servlet's
destroy() method.
- Unload the class.
If, on receiving a request, Tomcat discovers
that the servlet's class file has changed, it
- Calls the old servlet's
destroy() method,
- Unloads the old class, and
- Starts a new servlet life cycle (step 1. above).