I have written a servlet code and tried to call the servlet's destroy method. Now I can able to call the destroy method.
What happens after i call that method ?.. weather it will remove the servlet ?.. if not what it will do ?..
System.out.println("hey i got a call");
then you will get it printed, but nothing else. As Ben said, "its a place for you to put a cleanup code, if necessary".
It's there for you to override and put your cleanup code in.
Quote from the Servlet Specs SRV.188.8.131.52
public void destroy()
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. This method gives the servlet an opportunity to clean up any resources that are being held (for example, memory, file handles, threads) and make sure that any persistent state is synchronized with the servlet's current state in memory.