When I shutdown server, destroy() is not called in Eclipse.
public class Demo extends GenericServlet {
public void init(ServletConfig config) throws ServletException{
System.out.println("intit intialized");
}
public void service(ServletRequest request, ServletResponse response) throws ServletException, IOException {
System.out.println("servicccceeeeeeeee method........");
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.print("<h1>service method</h1>");
out.close();
}
public void destroy() {
System.out.printlnln(".........destroy method invoked.......");
}
}
When and how do I call the destroy method?