Calling servlet's destroy method

前端 未结 8 1634
执念已碎
执念已碎 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:39

    Couple of cases :

    1. when the container shuts down or the application shuts down;
    2. when the container decides that there is a shortage of memory;
    3. when this servlet hasn't got a request in a long time.

    As per the Doc

    Called by the servlet container to indicate to a servlet that the servlet is being taken out of service. This method is only called once all threads within the servlet's service method have exited or after a timeout period has passed. After the servlet container calls this method, it will not call the service method again on this servlet.

提交回复
热议问题