• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

destroy() for Servlet

 
Robert Paris
Ranch Hand
Posts: 585
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it guaranteed that this will be called when the server shuts down? If not, is there something that ensures a servlet is called on shutdown?
I am logging in every servlet (in the destroy() method) whether it was called. The weird thing is ONLY the servlets that are loaded on startup had their destroy() method called. Why is this?
[ January 29, 2003: Message edited by: Robert Paris ]
 
Robert Paris
Ranch Hand
Posts: 585
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I figured out why some weren't being called. They'd never been accessed, so they weren't instantiated, hence they couldn't be destroyed. (Duh - *smack my head*)
However, I still want to know if this is required: that the server calls all servlet "destroy()" methods on shutdown.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13064
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is in the servlet API as required but who knows if all servlet containers implement it correctly.
Bill
 
vijith vayanippetta
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Whatever servlets are loaded by the server, (ie init method of the servlet is invoked), will be destroyed by the server at shutdown.Only if the server crashes the destroy method will not be invoked.
 
Chris Stewart
Ranch Hand
Posts: 184
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've had issues with this myself. Using Tomcat 4.1.18 it would not execute the destroy() method after using my servlet.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13064
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've had issues with this myself. Using Tomcat 4.1.18 it would not execute the destroy() method after using my servlet.

How were you shutting Tomcat down?
Bill
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic