This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
What are the various ways to unload a servlet? more simply, when a servlet is called, it is loaded by the web server, the required method is called and after that the servlet is unloaded. So when can I be sure that my servlet has been unloaded??
hi rajeev! when the servlet is changed, old servlet will be unload.The servlet will be unloaded when the destroy method is called.you can unload the servlet by explicitely calling the destroy method.
Joined: Sep 13, 2000
The things are getting clearer ... thanks ... But this leads to another one ... i have coded a servlet and the servlet takes a value for a X variable from a file(txt or any other) in the INIT method and writes back the present(modified) value of the X variable to the same file in the DESTROY function. Now after updating the value of X, i closed the browser. 1. In this case, is the DESTROY function called? 2. If not, then who should be responsible for updating the file. 3. what could be the exact sequence?? Thanks in advance ... rajeev
Closing the browser has nothing to do with the servlet. The servlet might not be unloaded for days or weeks (if you are running a Unix server). The servlet will only get unloaded when the server decides that it needs to unload the servlet usually for memory purposes.