What kind of event triggers Servlet's end of life?
Servelt is destroyed by container in following situations -
When container shuts down.
When container found that there is memory shortage.
Destroy may also kicks if container finds that Servlet is not receiving any request for long time. This is container specific implementation.
In general the Servlet life span is same as of web application.
The container calls destroy() method of Servlet just before it reclaims its memory.
destroy() method is similar to finalize() method of any other Java class. destroy() if called by user defined function, it will execute but that does not end Servlet's life.
Once a Servlet is destroyed, the container creates a new instance if it receives associated request.
Servelt is destroyed by container in following situations -
When container shuts down.
When container found that there is memory shortage.
Destroy may also kicks if container finds that Servlet is not receiving any request for long time. This is container specific implementation.
In general the Servlet life span is same as of web application.
The container calls destroy() method of Servlet just before it reclaims its memory.
destroy() method is similar to finalize() method of any other Java class. destroy() if called by user defined function, it will execute but that does not end Servlet's life.
Once a Servlet is destroyed, the container creates a new instance if it receives associated request.


