Calling servlet's destroy method

前端 未结 8 1633
执念已碎
执念已碎 2021-01-01 16:03

As per the link http://www.xyzws.com/Servletfaq/when-is-destroy-of-servlets-called/20, one of the reason of calling destroy method is when the servlet hasn\'t got a

8条回答
  •  我在风中等你
    2021-01-01 16:40

    It totally depends on the implementation of the servlet container you are using. If your servlet container is very conservative for saving resources, it may destroy the servlet that is not in service for long time.

    In page 22 of servlet spec 2.5, you will find that, "When the servlet container determines that a servlet should be removed from service, it calls the destroy method of the Servlet interface to allow the servlet to release any resources it is using and save any persistent state. For example, the container may do this when it wants to conserve memory resources, or when it is being shut down."

提交回复
热议问题