Originally posted by amit taneja:
suppose in a case when we have intialised resourse in init() or jspInit() method and the jsp/servlet is served once then not been request for many days and resourse are loaded on memory and using memory! then in that case how can we remove the servlet/jsp from container ?
According to the spec, servlet containers are free to unload servlets to recover resources and then reload them if needed.
These are issues for the developers of the container itself; not for application developers. All we need to know is that the destroy method is there for us to put clean up code that needs to be called when the servlet is destroyed.
If you have a
JSP page that consumes so much memory that you need to explicitly load and unload it, you might want to re-think your architecture.
The servlet spec provides methods and objects that give you very fine grained control over the life cycle of beans and helper objects.