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

Popular posts from this blog

Can not connect to git using ssh (Permissions 0644 for '/root/.ssh/id_rsa' are too open.

Upload file on Google cloud storage using Java servlet on google app engine

Android: where to run keytool command in android