Win a copy of Rust Web Development this week in the Other Languages forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

When a Servlet destroy method is called.

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When a servlet destroy method is called, What is the timeout period after that the container calls the destroy method.
 
Ranch Hand
Posts: 453
Google Web Toolkit Hibernate Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
a servlet is loaded when the request comes for it and stay loaded until the application is on the server.

when the application is about to be shut down the destroy method is called for cleanup etc.

avi sinha
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

What is the timeout period after that the container calls the destroy method.



There is no "timeout" period. If a container decides to remove a servlet, for whatever reason, it will ensure there are no pending requests when destroy is called. Subsequent requests for that servlet will get an error message. Search for "servlet life cycle tutorial" to get expanded discussions.

Bill
 
Ranch Hand
Posts: 607
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

William Brogden wrote:
Subsequent requests for that servlet will get an error message.



Why would this happen? I would assume that if the server removed a servlet for some reason (other that shutting down, of course) a subsequent call to that servlet should load it again (call its init() again).
 
Bartender
Posts: 4109
72
Hibernate Fedora Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Sam Mercs wrote:

William Brogden wrote:
Subsequent requests for that servlet will get an error message.


Why would this happen? I would assume that if the server removed a servlet for some reason (other that shutting down, of course) a subsequent call to that servlet should load it again (call its init() again).


Yes. If the servlet throws UnavailableException (with a specific time) until that time expires response will return SC_SERVICE_UNAVAILABLE (503). Also the container may remove the instance as William stated may be to conserve memory etc... Any subsequent requests should be sent to a newly initialized instance.
 
reply
    Bookmark Topic Watch Topic
  • New Topic