| Author |
When a Servlet destroy method is called.
|
sasikumar srinivasan
Greenhorn
Joined: Aug 27, 2009
Posts: 4
|
|
|
When a servlet destroy method is called, What is the timeout period after that the container calls the destroy method.
|
 |
avi sinha
Ranch Hand
Joined: Mar 15, 2009
Posts: 452
|
|
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
|
SCJP 5.0 SCWCD 5.0
|
 |
William Brogden
Author and all-around good cowpoke
Rancher
Joined: Mar 22, 2000
Posts: 12265
|
|
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
|
Java Resources at www.wbrogden.com
|
 |
Saifuddin Merchant
Ranch Hand
Joined: Feb 08, 2009
Posts: 576
|
|
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).
|
Cheers - Sam.
Twisters - The new age Java Quiz || My Blog
|
 |
Vijitha Kumara
Bartender
Joined: Mar 24, 2008
Posts: 3670
|
|
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.
|
SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
|
 |
 |
|
|
subject: When a Servlet destroy method is called.
|
|
|