Timesgroups interview questions: Servlet lifecycle : who called destroy() method of servlet

destroy() method is called by the servlet container. It is 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.
    public void destroy() {
      anyDB = null;
    }
How container knows that all the threads are exited and where we specify the timeout period for a servlet.

For more, visit link: http://docs.oracle.com/javaee/1.4/tutorial/doc/Servlets12.html

Comments

Popular posts from this blog

Struts 2 : Warning :No configuration found for the specified action: 'Login.action' in namespace: '/'

Upload csv file at Google Cloud Storage using java

Read Images from a xlsx file using Apache POI