• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

servlet unloading

 
rajeev holkar
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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??
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
rajeev holkar
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Steve Fahlbusch
Bartender
Posts: 605
7
Mac OS X Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a question about the Distroy.
Will the distroy cause the servlet to be unload immeaditatly or is it like garbage collection?
Thanks
 
Thomas Paul
mister krabs
Ranch Hand
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
rajeev holkar
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hmmmmmmmmmm .... this is something ....
Thanks Paul.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic